line 64 has a logical error: if ((value >> 15) & 1 == 0) { should be changed to: if (((value >> 15) & 1) == 0) { The parentheses around the AND operation were missing so the wrong logical comparison was being performed.