Java Integer Create toInts(byte[] src, int srcOffset, int[] dst, int dstOffset, int length)

Here you can find the source of toInts(byte[] src, int srcOffset, int[] dst, int dstOffset, int length)

Description

to Ints

License

Open Source License

Declaration

public static void toInts(byte[] src, int srcOffset, int[] dst,
            int dstOffset, int length) 

Method Source Code

//package com.java2s;

public class Main {
    public static void toInts(byte[] src, int srcOffset, int[] dst,
            int dstOffset, int length) {
        if (length < 0)
            throw new IllegalArgumentException(
                    "length must be >= 0, length = " + length);

        for (int i = dstOffset; i < dstOffset + length; i++) {
            dst[i] = getInt(src, srcOffset);
            srcOffset += 4;// w  w  w.j  a  va2  s.  co  m
        }
    }

    public static final int getInt(byte[] data, int position) {
        int a = data[position + 0] & 255;
        int b = data[position + 1] & 255;
        int c = data[position + 2] & 255;
        int d = data[position + 3] & 255;

        return makefourcc(a, b, c, d);
    }

    public static final int makefourcc(int c0, int c1, int c2, int c3) {
        return c0 | (c1 << 8) | (c2 << 16) | (c3 << 24);
    }
}

Related

  1. toIntOrNull(String string)
  2. toIntPlusOneString(Object object)
  3. toIntRound(double[] a)
  4. toInts(byte[] bytes)
  5. toInts(byte[] readBuffer, int o, int l)
  6. toInts(byte[] value, int offset, int num)
  7. toInts(double[] arr)
  8. toInts(int val)
  9. toInts(Integer[] values)