@Test public void testToLongMSB() { String dpidStr = "ca:7c:5e:d1:64:7a:95:9b"; long valid = -3856102927509056101L; long testLong = HexString.toLong(dpidStr); TestCase.assertEquals(valid, testLong); }
public static long toLong(String values) throws NumberFormatException { BigInteger bi = new BigInteger(values.replaceAll(":", ""),16); if (bi.bitLength() > 64) throw new NumberFormatException("Input string too big to fit in long: " + values); return bi.longValue(); }
HexString { public static long toLong(String values) throws NumberFormatException { BigInteger bi = new BigInteger(values.replaceAll(":", ""),16); if (bi.bitLength() > 64) throw new NumberFormatException("Input string too big to fit in long: " + values); return bi.longValue(); } }
HexString { public static long toLong(String values) throws NumberFormatException { BigInteger bi = new BigInteger(values.replaceAll(":", ""),16); if (bi.bitLength() > 64) throw new NumberFormatException("Input string too big to fit in long: " + values); return bi.longValue(); }  }
HexString { public static long toLong(String values) throws NumberFormatException { BigInteger bi = new BigInteger(values.replaceAll(":", ""),16); if (bi.bitLength() > 64) throw new NumberFormatException("Input string too big to fit in long: " + values); return bi.longValue(); }  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 long toLong(String values) throws NumberFormatException { BigInteger bi = new BigInteger(values.replaceAll(":", ""),16); if (bi.bitLength() > 64) throw new NumberFormatException("Input string too big to fit in long: " + values); return bi.longValue(); }  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);  }