class Bytes {

    public static int[] toIntArray(byte[] ba, int amount, boolean bigEndian) {
        final int size = determineSize(amount, ba.length, 4);
        int[] result = new int[size / 4];
        int i = 0;
        for (int j = 0; j < size; j += 4) {
            if (bigEndian) {
                result[i++] = toInt(ba[j], ba[j + 1], ba[j + 2], ba[j + 3], true);
            } else {
                result[i++] = toInt(ba[j + 3], ba[j + 2], ba[j + 1], ba[j], true);
            }
        }
        return result;
    }

}