Tuesday, August 16, 2011

Using JOptionPAne Converter for Decimal To Hexadecimal


import javax.swing.JOptionPane;
 import java.io.*;
 import java.lang.*;
public class DecimalToHexadecimal {
   
    public static void main(String[] args) {
    String hex;
        hex = JOptionPane.showInputDialog(null, "Enter the decimal value:");
        int i = Integer.parseInt(hex);
        String hex1 = Integer.toHexString(i);
       JOptionPane.showMessageDialog(null, "Hexa decimal: " + hex1,"Result", JOptionPane.INFORMATION_MESSAGE);
       System.exit(0);
    }
}

No comments:

Post a Comment