Class FloatingPoint


  • public class FloatingPoint
    extends java.lang.Object
    Converters from floating point bytes to Java float, double, or java.math.BigDecimal.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int IEEE_754_FLOATING_POINT
      Supported Unix Big Endian IEEE 754 floating point representation.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private FloatingPoint()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static int convertFromByteToInt​(byte[] buffer, int offset)
      Convert the byte array to an int.
      private static long convertFromByteToLong​(byte[] buffer, int offset)
      Convert the byte array to a long.
      (package private) static double getDouble​(byte[] buffer, int offset)
      Build a Java double from an 8-byte floating point representation.
      (package private) static float getFloat​(byte[] buffer, int offset)
      Build a Java float from a 4-byte floating point representation.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • IEEE_754_FLOATING_POINT

        public static final int IEEE_754_FLOATING_POINT
        Supported Unix Big Endian IEEE 754 floating point representation.
        See Also:
        Constant Field Values
    • Constructor Detail

      • FloatingPoint

        private FloatingPoint()
    • Method Detail

      • convertFromByteToInt

        private static final int convertFromByteToInt​(byte[] buffer,
                                                      int offset)
        Convert the byte array to an int.
      • convertFromByteToLong

        private static final long convertFromByteToLong​(byte[] buffer,
                                                        int offset)
        Convert the byte array to a long.
      • getFloat

        static float getFloat​(byte[] buffer,
                              int offset)

        Build a Java float from a 4-byte floating point representation.

        This includes DERBY types:

        • REAL
        • FLOAT(1<=n<=24)
        Throws:
        java.lang.IllegalArgumentException - if the specified representation is not recognized.
      • getDouble

        static double getDouble​(byte[] buffer,
                                int offset)
        Build a Java double from an 8-byte floating point representation.

        This includes DERBY types:

        • FLOAT
        • DOUBLE [PRECISION]
        Throws:
        java.lang.IllegalArgumentException - if the specified representation is not recognized.