One time, out of boredom, I wrote a little utility called BitVerifier. It would loop over a folder and check every bit of each file. If the bit's value wasn't one or zero, it would prompt the user for the correct bit. At least in theory. I somehow never encountered a file with a "two" bit. But I got one key component right – an understanding of the valid range of values.

Rob K.'s colleague didn't even get that far.

private static final String[] HEX_STRING_VALUES = {"0", "1", "2", "3",
    "4", "5", "6", "7", "8", "9", "10", "A", "B", "C", "D", "E", "F"};

But wait, that's not the whole WTF! Consider this code later in the class:

StringBuilder sb = new StringBuilder();
for ( int h = 0; h < 6; h++ ) {
    int randomHex = randomGen.nextInt(HEX_STRING_VALUES.length);
    sb.append( HEX_STRING_VALUES[randomHex] );
}
//for some crazy reason, sometimes the loop above creates 7 chars.
//that is why the below usees substring to get exactly 6 Hex chars.
defaultVisualStyle.setColor( "0x" + sb.substring( 0, 6 ) );

"Some crazy reason" indeed. For "some crazy reason," the output could be up to twelve characters. It might have something to do with the fact that the "hex" array has 17 values, and that one of them is "10."

For some crazy reason, this individual won't be writing code in this project anymore.

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!