@Test public void testLongConvertion() { long result = AddressUtils.toLong("F000000AC6CD0301"); Assert.assertEquals(-1152921458321849599L, result); }
public static long toLong(String address) { long result = 0; for (int i = 0; i < 8; i++) { byte address_byte = (byte) ((Character.digit((address.charAt(i * 2)), 16) << 4) | (Character.digit(address .charAt(i * 2 + 1), 16))); result <<= 8; result |= (long) (address_byte & 0xFF); } return result; }
AddressUtils { public static long toLong(String address) { long result = 0; for (int i = 0; i < 8; i++) { byte address_byte = (byte) ((Character.digit((address.charAt(i * 2)), 16) << 4) | (Character.digit(address .charAt(i * 2 + 1), 16))); result <<= 8; result |= (long) (address_byte & 0xFF); } return result; } }
AddressUtils { public static long toLong(String address) { long result = 0; for (int i = 0; i < 8; i++) { byte address_byte = (byte) ((Character.digit((address.charAt(i * 2)), 16) << 4) | (Character.digit(address .charAt(i * 2 + 1), 16))); result <<= 8; result |= (long) (address_byte & 0xFF); } return result; }  }
AddressUtils { public static long toLong(String address) { long result = 0; for (int i = 0; i < 8; i++) { byte address_byte = (byte) ((Character.digit((address.charAt(i * 2)), 16) << 4) | (Character.digit(address .charAt(i * 2 + 1), 16))); result <<= 8; result |= (long) (address_byte & 0xFF); } return result; }  static String toString(long address); static long toLong(String address); }
AddressUtils { public static long toLong(String address) { long result = 0; for (int i = 0; i < 8; i++) { byte address_byte = (byte) ((Character.digit((address.charAt(i * 2)), 16) << 4) | (Character.digit(address .charAt(i * 2 + 1), 16))); result <<= 8; result |= (long) (address_byte & 0xFF); } return result; }  static String toString(long address); static long toLong(String address);  }