LittleEndianConversions (Bouncy Castle Library 1.54 API Specification)
Date: 2015-12-29

org.bouncycastle.pqc.math.linearalgebra

## Class LittleEndianConversions

- java.lang.Object
- - org.bouncycastle.pqc.math.linearalgebra.LittleEndianConversions

-     public final class LittleEndianConversions
      extends java.lang.Object

  This is a utility class containing data type conversions using little-endian byte order.
  See Also:
    `BigEndianConversions`

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static byte[]` | `I2OSP(int x)` Convert an integer to an octet string of length 4.
    `static void` | `I2OSP(int value, byte[] output, int outOff)` Convert an integer into a byte array beginning at the specified offset.
    `static void` | `I2OSP(int value, byte[] output, int outOff, int outLen)` Convert an integer to a byte array beginning at the specified offset.
    `static byte[]` | `I2OSP(long input)` Convert an integer to a byte array of length 8.
    `static void` | `I2OSP(long input, byte[] output, int outOff)` Convert an integer to a byte array of length 8.
    `static int` | `OS2IP(byte[] input)` Convert an octet string of length 4 to an integer.
    `static int` | `OS2IP(byte[] input, int inOff)` Convert an byte array of length 4 beginning at `offset` into an integer.
    `static int` | `OS2IP(byte[] input, int inOff, int inLen)` Convert a byte array of the given length beginning at `offset` into an integer.
    `static long` | `OS2LIP(byte[] input, int inOff)` Convert a byte array of length 8 beginning at `inOff` into a long integer.
    `static byte[]` | `toByteArray(int[] input, int outLen)` Convert an int array to a byte array of the specified length.
    `static int[]` | `toIntArray(byte[] input)` Convert a byte array to an int array.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### OS2IP

          public static int OS2IP(byte[] input)

      Convert an octet string of length 4 to an integer. No length checking is performed.
      Parameters:
        `input` - the byte array holding the octet string
      Returns:
        an integer representing the octet string `input`
      Throws:
        `java.lang.ArithmeticException` - if the length of the given octet string is larger than 4.

    - #### OS2IP

          public static int OS2IP(byte[] input,
                  int inOff)

      Convert an byte array of length 4 beginning at `offset` into an integer.
      Parameters:
        `input` - the byte array
        `inOff` - the offset into the byte array
      Returns:
        the resulting integer

    - #### OS2IP

          public static int OS2IP(byte[] input,
                  int inOff,
                  int inLen)

      Convert a byte array of the given length beginning at `offset` into an integer.
      Parameters:
        `input` - the byte array
        `inOff` - the offset into the byte array
        `inLen` - the length of the encoding
      Returns:
        the resulting integer

    - #### OS2LIP

          public static long OS2LIP(byte[] input,
                    int inOff)

      Convert a byte array of length 8 beginning at `inOff` into a long integer.
      Parameters:
        `input` - the byte array
        `inOff` - the offset into the byte array
      Returns:
        the resulting long integer

    - #### I2OSP

          public static byte[] I2OSP(int x)

      Convert an integer to an octet string of length 4.
      Parameters:
        `x` - the integer to convert
      Returns:
        the converted integer

    - #### I2OSP

          public static void I2OSP(int value,
                   byte[] output,
                   int outOff)

      Convert an integer into a byte array beginning at the specified offset.
      Parameters:
        `value` - the integer to convert
        `output` - the byte array to hold the result
        `outOff` - the integer offset into the byte array

    - #### I2OSP

          public static void I2OSP(int value,
                   byte[] output,
                   int outOff,
                   int outLen)

      Convert an integer to a byte array beginning at the specified offset. No length checking is performed (i.e., if the integer cannot be encoded with `length` octets, it is truncated).
      Parameters:
        `value` - the integer to convert
        `output` - the byte array to hold the result
        `outOff` - the integer offset into the byte array
        `outLen` - the length of the encoding

    - #### I2OSP

          public static byte[] I2OSP(long input)

      Convert an integer to a byte array of length 8.
      Parameters:
        `input` - the integer to convert
      Returns:
        the converted integer

    - #### I2OSP

          public static void I2OSP(long input,
                   byte[] output,
                   int outOff)

      Convert an integer to a byte array of length 8.
      Parameters:
        `input` - the integer to convert
        `output` - byte array holding the output
        `outOff` - offset in output array where the result is stored

    - #### toByteArray

          public static byte[] toByteArray(int[] input,
                           int outLen)

      Convert an int array to a byte array of the specified length. No length checking is performed (i.e., if the last integer cannot be encoded with `length % 4` octets, it is truncated).
      Parameters:
        `input` - the int array
        `outLen` - the length of the converted array
      Returns:
        the converted array

    - #### toIntArray

          public static int[] toIntArray(byte[] input)

      Convert a byte array to an int array.
      Parameters:
        `input` - the byte array
      Returns:
        the converted array