Java Integer Create toInts(byte[] readBuffer, int o, int l)

Here you can find the source of toInts(byte[] readBuffer, int o, int l)

Description

to Ints

License

Open Source License

Declaration

public static int[] toInts(byte[] readBuffer, int o, int l) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static int[] toInts(byte[] readBuffer, int o, int l) {
        int[] v = new int[l / 4];
        for (int i = 0; i < v.length; i++)
            v[i] = toInt(readBuffer, o + i * 4);
        return v;
    }//from  ww w.  jav a2s.c  om

    public static int toInt(byte[] readBuffer, int o) {
        int ch1 = readBuffer[o++];
        int ch2 = readBuffer[o++];
        int ch3 = readBuffer[o++];
        int ch4 = readBuffer[o++];
        if ((ch1 | ch2 | ch3 | ch4) < 0)
            throw new IllegalStateException();
        return ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + (ch4 << 0));
    }

    public static int toInt(byte[] readBuffer) {
        return toInt(readBuffer, 0);
    }
}

Related

  1. toIntMatrix(Number[][] matrix)
  2. toIntOrNull(String string)
  3. toIntPlusOneString(Object object)
  4. toIntRound(double[] a)
  5. toInts(byte[] bytes)
  6. toInts(byte[] src, int srcOffset, int[] dst, int dstOffset, int length)
  7. toInts(byte[] value, int offset, int num)
  8. toInts(double[] arr)
  9. toInts(int val)