/**
 * Print the bits in the represntation of a floating-point number
 * supplied on the command line.
 *
 * @author Samuel A. Rebelsky
 * @version 1.0 of February 2003
 */
public class PrintFloatBits
{
  /**
   * Grab the floating-point number from the command line, convert
   * it to bits, and print 'em out.
   */
  public static void main(String[] args) {
    // (1) Convert the string to a float.
    float f = Float.parseFloat(args[0]);
    // (2) Convert the float to an integer with equivalent bit pattern.
    int i = Float.floatToIntBits(f);
    // (3) Conver the integer to a bit string (missing leading 0's).
    String bits = Integer.toBinaryString(i);
    // (4) Print out the result.
    System.out.println(args[0] + " is represented as " + bits);
    // (5) Be nice to the operating system.
    System.exit(0);
  } // main(String[])

} // class PrintFloatBits
