<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">class DumpFloat {

   static void dumpFloat(float f) {
      int i = Float.floatToRawIntBits(f);
      System.out.print("float " + f + " = ");
      for (int j = 31; j &gt;= 0; j--) {
         System.out.print((i &amp; (1 &lt;&lt; j)) == 0 ? "0" : "1");
      }
      System.out.println("");
   }

   public static void main(String[] args) {
      float[] a = { 0.0f, 1.0f, -2.0f, 10.0f, -0.0f, 1.0e38f,
               Float.POSITIVE_INFINITY, Float.NEGATIVE_INFINITY, Float.NaN };
      for (int i = 0; i &lt; a.length; i++) {
         dumpFloat(a[i]);
      }
      float x = 1000000.0f;
      float y = 1000000.1f;
      System.out.println("difference is" + (y - x));
      while (x &gt; 0.0) {
         x = x / 2;
         System.out.println("Now x is " + x);
      }
   }
}
</pre></body></html>