@Test public void testToBinaryString() throws Exception { assertEquals("00000000", ByteUtil.toBinaryString(b)); assertEquals("00000001", ByteUtil.toBinaryString((byte) 1)); assertEquals("00000111", ByteUtil.toBinaryString((byte) 7)); assertEquals("10000000", ByteUtil.toBinaryString((byte) (1 << 7))); }
public static String toBinaryString(final byte number) { final StringBuilder builder = new StringBuilder(Byte.SIZE); for (int i = 0; i < Byte.SIZE; i++) { final int q = number & POWERS[Byte.SIZE - 1 - i]; builder.append(q != 0 ? '1' : '0'); } return builder.toString(); }
ByteUtil { public static String toBinaryString(final byte number) { final StringBuilder builder = new StringBuilder(Byte.SIZE); for (int i = 0; i < Byte.SIZE; i++) { final int q = number & POWERS[Byte.SIZE - 1 - i]; builder.append(q != 0 ? '1' : '0'); } return builder.toString(); } }
ByteUtil { public static String toBinaryString(final byte number) { final StringBuilder builder = new StringBuilder(Byte.SIZE); for (int i = 0; i < Byte.SIZE; i++) { final int q = number & POWERS[Byte.SIZE - 1 - i]; builder.append(q != 0 ? '1' : '0'); } return builder.toString(); } private  ByteUtil(); }
ByteUtil { public static String toBinaryString(final byte number) { final StringBuilder builder = new StringBuilder(Byte.SIZE); for (int i = 0; i < Byte.SIZE; i++) { final int q = number & POWERS[Byte.SIZE - 1 - i]; builder.append(q != 0 ? '1' : '0'); } return builder.toString(); } private  ByteUtil(); static byte setTrue(final byte number, final int index); static byte setFalse(final byte number, final int index); static boolean isTrue(final byte number, final int index); static boolean isFalse(final byte number, final int index); static byte toByte(boolean... values); static boolean[] fromByte(byte b); static String toBinaryString(final byte number); }
ByteUtil { public static String toBinaryString(final byte number) { final StringBuilder builder = new StringBuilder(Byte.SIZE); for (int i = 0; i < Byte.SIZE; i++) { final int q = number & POWERS[Byte.SIZE - 1 - i]; builder.append(q != 0 ? '1' : '0'); } return builder.toString(); } private  ByteUtil(); static byte setTrue(final byte number, final int index); static byte setFalse(final byte number, final int index); static boolean isTrue(final byte number, final int index); static boolean isFalse(final byte number, final int index); static byte toByte(boolean... values); static boolean[] fromByte(byte b); static String toBinaryString(final byte number);  }