System.out.println(Integer.parseInt("4B5CE3D77A73",16);
throws me a number format exception. and the mac address is valid one which is generated from this site http://www.miniwebtool.com/mac-address-generator/
Do i miss something here ?
System.out.println(Integer.parseInt("4B5CE3D77A73",16);
throws me a number format exception. and the mac address is valid one which is generated from this site http://www.miniwebtool.com/mac-address-generator/
Do i miss something here ?
Looks like the number is greater than what Integer can hold. Try with Long:
Long.parseLong("4B5CE3D77A73",16)
Documentation states that it throws NumberFormatException - if the string does not contain a parsable integer
. Not only if the string contains invalid characters but also if the number is greater than Integer.MAX_VALUE
.
The number does not fit to an integer, which's maximum value is:
System.out.println(Integer.MAX_VALUE); // prints 2147483647
Try the following:
Long.parseLong("4B5CE3D77A73",16); // 0x4B5CE3D77A73 == 82862331624051
i think you should convert it to hexa format. this may help you.