Pages

Saturday, May 02, 2009

Converting hexadecimal to decimal in JAVA

This is really as simple as it is.

import java.io.*;
import java.lang.*;

public class HexadecimalToDecimal{
public static void main(String[] args) throws IOException{
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the Hexadecimal number:");
String str= bf.readLine();
int i= Integer.parseInt(str,16);
System.out.println("Decimal:="+ i);
}
}

No comments:

Post a Comment