Is there any method in Java that will convert hexadecimal characters to binary characters?
Created May 7, 2012
long magic = Long.parseLong("CAFEBABE", 16);where the second argument to the method represents the radix used to encode the first parameter (in this case, base 16, or hexadecimal).
You can also convert hexadecimal number directly into Integer or Long objects using the methods Integer.decode() or Long.decode(), respectively.
If you wish to subsequently print out these values as a String in base 2 (binary), you can use either Integer.toBinaryString() or Long.toBinaryString().
See the API documentation for Integer and Long for more detail.