In this section, you will learn to convert hexadecimal data into integer.
Convert Hexadecimal number into Integer
In this section, you will learn to convert hexadecimal data into integer. The java.lang package provides the functionally to convert the hexadecimal data into an integer type data.
Code Description:
The following program takes an integer type data at the console (using the keyboard) and converts the hexadecimal data into an integer type data using valueOf() method. It take a number as a string. It converts the number into an integer data using the Integer.valueOf() method.
Integer.valueOf() :The Integer.valueOf() returns an integer object containing the value extracted from the specified String. The result is an integer that represents the integer value specified by the string .
Here is full code of this program:
import java.io.*;
|
Output of this program.
C:\corejava>java HexaToInteger Enter the hexadecimal value:! 24 Integer:=36 C:\corejava> |