Class Int128

java.lang.Object
io.trino.spi.type.Int128
All Implemented Interfaces:
Comparable<Int128>

public class Int128 extends Object implements Comparable<Int128>
  • Field Details

    • SIZE

      public static final int SIZE
      See Also:
    • INSTANCE_SIZE

      public static final int INSTANCE_SIZE
    • MAX_VALUE

      public static final Int128 MAX_VALUE
    • MIN_VALUE

      public static final Int128 MIN_VALUE
    • ONE

      public static final Int128 ONE
    • ZERO

      public static final Int128 ZERO
  • Method Details

    • fromBigEndian

      public static Int128 fromBigEndian(byte[] bytes)
      Decode an Int128 from the two's complement big-endian representation.
      Parameters:
      bytes - the two's complement big-endian encoding of the number. It must contain at least 1 byte. It may contain more than 16 bytes if the leading bytes are not significant (either zeros or -1)
      Throws:
      ArithmeticException - if the bytes represent a number outside of the range [-2^127, 2^127 - 1]
    • valueOf

      public static Int128 valueOf(long[] value)
    • valueOf

      public static Int128 valueOf(long high, long low)
    • valueOf

      public static Int128 valueOf(String value)
    • valueOf

      public static Int128 valueOf(BigInteger value)
    • valueOf

      public static Int128 valueOf(long value)
    • getHigh

      public long getHigh()
    • getLow

      public long getLow()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • compareTo

      public int compareTo(Int128 other)
      Specified by:
      compareTo in interface Comparable<Int128>
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toBigInteger

      public BigInteger toBigInteger()
    • toBigEndianBytes

      public byte[] toBigEndianBytes()
    • toBigEndianBytes

      public void toBigEndianBytes(byte[] bytes, int offset)
    • toLong

      public long toLong()
    • toLongExact

      public long toLongExact()
    • toLongArray

      public long[] toLongArray()
    • compare

      public static int compare(long leftHigh, long leftLow, long rightHigh, long rightLow)
    • isZero

      public boolean isZero()
    • isNegative

      public boolean isNegative()