@Test public void testByte2Hex() { int i; String[] expected_hex = {"01", "02", "04", "08", "10", "20", "40", "80"}; byte control_byte[] = {1, 2, 4, 8, 16, 32, 64, -128}; for (i = 0; i < control_byte.length; i++) { assertEquals(expected_hex[i], BitConverters.byte2hex(control_byte[i])); } }
public static String byte2hex(byte ubyte) { byte[] nibbleBytes; String out; int num; int lo; int hi; num = ubyte2int(ubyte); lo = ubyte & 0x0f; hi = (ubyte & 0xf0) >> 4; nibbleBytes = new byte[]{int2Nibble(hi), int2Nibble(lo)}; out = new String(nibbleBytes); return out; }
BitConverters { public static String byte2hex(byte ubyte) { byte[] nibbleBytes; String out; int num; int lo; int hi; num = ubyte2int(ubyte); lo = ubyte & 0x0f; hi = (ubyte & 0xf0) >> 4; nibbleBytes = new byte[]{int2Nibble(hi), int2Nibble(lo)}; out = new String(nibbleBytes); return out; } }
BitConverters { public static String byte2hex(byte ubyte) { byte[] nibbleBytes; String out; int num; int lo; int hi; num = ubyte2int(ubyte); lo = ubyte & 0x0f; hi = (ubyte & 0xf0) >> 4; nibbleBytes = new byte[]{int2Nibble(hi), int2Nibble(lo)}; out = new String(nibbleBytes); return out; }  }
BitConverters { public static String byte2hex(byte ubyte) { byte[] nibbleBytes; String out; int num; int lo; int hi; num = ubyte2int(ubyte); lo = ubyte & 0x0f; hi = (ubyte & 0xf0) >> 4; nibbleBytes = new byte[]{int2Nibble(hi), int2Nibble(lo)}; out = new String(nibbleBytes); return out; }  static String int16bit2hex(int i16); static int hex16bit2int(String in); static int nibble2Int(byte nibble); static byte int2Nibble(int in); static int ubyte2int(byte in); static byte int2ubyte(int in); static String byte2hex(byte ubyte); static byte[] uint2bytes(int in); static String bytes2hex(byte[] bytes); }
BitConverters { public static String byte2hex(byte ubyte) { byte[] nibbleBytes; String out; int num; int lo; int hi; num = ubyte2int(ubyte); lo = ubyte & 0x0f; hi = (ubyte & 0xf0) >> 4; nibbleBytes = new byte[]{int2Nibble(hi), int2Nibble(lo)}; out = new String(nibbleBytes); return out; }  static String int16bit2hex(int i16); static int hex16bit2int(String in); static int nibble2Int(byte nibble); static byte int2Nibble(int in); static int ubyte2int(byte in); static byte int2ubyte(int in); static String byte2hex(byte ubyte); static byte[] uint2bytes(int in); static String bytes2hex(byte[] bytes);  }