//the following program throws a Number format exception when an invalid hexadecimal string is given as input
/**
*
* @author vishnu
*/
import java.io.*;
import java.lang.*;
import java.util.Scanner;
public class HexString {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException{
Scanner S=new Scanner(System.in);
System.out.println(“Enter the Hexadecimal number:”);
String str= S.next();
int i= Integer.parseInt(str,16);
System.out.println(“Decimal:=”+ i);
}
}