How to Convert Hexadecimal to Decimal Integers in Java


In this example, we will use valueOf method of integer wrapper class to convert hexadecimal to decimal number.

Source Code

package com.beginner.examples;

public class ConvertHexadecimalToInteger {

	public static void main(String[] args) {

		String strhex = "3c";

		// Use the parseInt() method in the Integer class to parse an Integer
		int n = Integer.parseInt(strhex, 16);

		System.out.println(n);

	}

}

Output:

60
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments