@Test public void testToStringBytes() { byte[] dpid = { 0, 0, 0, 0, 0, 0, 0, -1 }; String valid = "00:00:00:00:00:00:00:ff"; String testString = HexString.toHexString(dpid); TestCase.assertEquals(valid, testString); }
public static String toHexString(byte[] bytes) { if (bytes == null) return ""; int i; String ret = ""; String tmp; for(i=0; i< bytes.length; i++) { if(i> 0) ret += ":"; tmp = Integer.toHexString(U8.f(bytes[i])); if (tmp.length() == 1) ret += "0"; ret += tmp; } return ret; }
HexString { public static String toHexString(byte[] bytes) { if (bytes == null) return ""; int i; String ret = ""; String tmp; for(i=0; i< bytes.length; i++) { if(i> 0) ret += ":"; tmp = Integer.toHexString(U8.f(bytes[i])); if (tmp.length() == 1) ret += "0"; ret += tmp; } return ret; } }
HexString { public static String toHexString(byte[] bytes) { if (bytes == null) return ""; int i; String ret = ""; String tmp; for(i=0; i< bytes.length; i++) { if(i> 0) ret += ":"; tmp = Integer.toHexString(U8.f(bytes[i])); if (tmp.length() == 1) ret += "0"; ret += tmp; } return ret; }  }
HexString { public static String toHexString(byte[] bytes) { if (bytes == null) return ""; int i; String ret = ""; String tmp; for(i=0; i< bytes.length; i++) { if(i> 0) ret += ":"; tmp = Integer.toHexString(U8.f(bytes[i])); if (tmp.length() == 1) ret += "0"; ret += tmp; } return ret; }  static String toHexString(byte[] bytes); static String toHexString(long val, int padTo); static String toHexString(long val); static byte[] fromHexString(String values); static long toLong(String values); }
HexString { public static String toHexString(byte[] bytes) { if (bytes == null) return ""; int i; String ret = ""; String tmp; for(i=0; i< bytes.length; i++) { if(i> 0) ret += ":"; tmp = Integer.toHexString(U8.f(bytes[i])); if (tmp.length() == 1) ret += "0"; ret += tmp; } return ret; }  static String toHexString(byte[] bytes); static String toHexString(long val, int padTo); static String toHexString(long val); static byte[] fromHexString(String values); static long toLong(String values);  }