In  this tutorial, we will see “How to convert Binary to HexaDecimal using Java?”

How to convert Binary to hexadecimal number in java

Java – How to convert Binary to Hexadecimal Number? Share on X

/**
 * Using Java, Convert Binary to HexaDecimal Number
 * @author Deepak Verma
 *
 */

public class Convert_Binary_To_HexaDecimal_Java_Example {

	public static void main(String[] args) {

		String binaryValue = "110101111";
		System.out.println("Hexadecimal value of Binary ("+binaryValue+") is: "+binaryToHexadecimal(binaryValue));

	}

	public static String binaryToHexadecimal(String binaryValue) {

		return Integer.toHexString(Integer.parseInt(binaryValue, 2));

	}
}

 

Output:

Hexadecimal value of Binary (110101111) is: 1af

How to convert Binary to hexadecimal number in java

Java – How to convert Binary to Hexadecimal Number? Share on X

Do you like this Post? – then check my other helpful posts:

Other Useful References:

Author

  • Deepak Verma

    Deepak Verma is a Test Automation Consultant and Software development Engineer for more than 10 years. His mission is to help you become an In-demand full stack automation tester.

    He is also the founder of Techndeck, a blog and online coaching platform dedicated to helping you succeed with all the automation basics to advanced testing automation tricks.

    View all posts