|
|
|
Show HN: an extremely simple program shows a 2D structure in the integers
|
|
24 points
by sage_joch
4463 days ago
|
|
This seems unlikely to be a "new" idea, but I stumbled into it by accident and thought it was cool. Java source code below: // This class is in the public domain.
public class Numbers
{
public static void main(String[] args)
{
int numRows = 256;
int numColumns = 128;
for (int row = 0; row < numRows; row++)
{
StringBuilder rowOutput = new StringBuilder();
for (int column = 0; column < numColumns; column++)
{
if ((row & column) != 0)
rowOutput.append("1");
else
rowOutput.append("0");
}
System.out.println(
String.format("row/col %s:\t%s", row, rowOutput.toString()));
}
}
}
|
|
The whole page is a delight, though, and given your enjoyment for your discovery, you'll certainly love browsing it.