import javax.swing.JOptionPane;

public class bit
{
public static void main(String [] args)
{
int x;
String HexStr, BinStr;

do {

String userInput = JOptionPane.showInputDialog("Enter a number: ");
x = 0;
if (userInput != null)
   {
   x = Integer.parseInt( userInput );
   }

BinStr = Integer.toString( x, 2 );
HexStr = Integer.toString( x, 16 );

JOptionPane.showMessageDialog( null, "Decimal: " + x + "\n   Binary: " +  BinStr + "\n      Hex: " + HexStr );

} while( x != 0 );

System.exit(0);

} // end main

} // end class
