How to parse hex number in [java]
Hi, We will learn how to parse hex int number parse use bitwise operation let's do it int hexNum = (int) 0xabcd; System.out.println("hexNum binary string " + Integer.toBinaryString(hexNum)); System.out.println("hexNum hex string " + String.format("%02x",hexNum)); // 02 is number of digits // lets get ab System.out.println("hexNum binary string " + Integer.toBinaryString(hexNum&0xFF)); // multiplay by ff System.out.println("hexNum hex string " + String.format("%02x",(hexNum&0xFF))); // 02 is number of digits // lets get cd System.out.println("hexNum binary string " + Integer.toBinaryString((hexNum>>8))); //8 bit shift rigth System.out.println("hexNum hex string " + String.format("%02x",(hexNum>>8))); // 02 is number of digits //8 bit shift rigth