Class NumberUtils

java.lang.Object
is.galia.util.NumberUtils

public final class NumberUtils extends Object
  • Method Details

    • readSignedInt

      public static int readSignedInt(byte[] bytes, ByteOrder byteOrder)
      Parameters:
      bytes - Array of 1 to 4 bytes. Bytes beyond these are ignored.
      byteOrder - Byte order of the array.
      Returns:
      Signed value.
    • readSignedLong

      public static long readSignedLong(byte[] bytes, ByteOrder byteOrder)
      Parameters:
      bytes - Array of 1 to 8 bytes. Bytes beyond these are ignored.
      byteOrder - Byte order of the array.
      Returns:
      Signed value.
    • readSignedShort

      public static int readSignedShort(byte[] bytes, ByteOrder byteOrder)
      Parameters:
      bytes - Array of 1 to 2 bytes. Bytes beyond these are ignored.
      byteOrder - Byte order of the array.
      Returns:
      Signed value.
    • readUnsignedInt

      public static long readUnsignedInt(byte[] bytes, ByteOrder byteOrder)
      Parameters:
      bytes - Array of 1 to 4 bytes. Bytes beyond these are ignored.
      byteOrder - Byte order of the array.
      Returns:
      Unsigned value.
    • readUnsignedShort

      public static int readUnsignedShort(byte[] bytes, ByteOrder byteOrder)
      Parameters:
      bytes - Array of 1 to 2 bytes. Bytes beyond these are ignored.
      byteOrder - Byte order of the array.
      Returns:
      Unsigned value.
    • toByteArray

      public static byte[] toByteArray(int value, ByteOrder byteOrder)
    • toByteArray

      public static byte[] toByteArray(long value, ByteOrder byteOrder)