You can convert Hexadecimal numbers into Binary(base 2) by using a simple java code.
If you use very large number, use long or if you use small number, so you can use int.
For example
public class HexToBin{
public static void main(String args[]){
int value=0xA5 ; //Assign any hexadecimal number that you want to convert into binary
String inBin=Integer.Integer.toBinaryString(value); //Converts to binary string using wrapper class.
System.out.println(Converted value is "+inBin); //Prints it out to console.
JOptionPane.showMessageDialog(null, ""+i);//Shows Message dialog also.
}
}
No comments:
Post a Comment