Java Integer Create toIntArray(final byte[] array)

Here you can find the source of toIntArray(final byte[] array)

Description

to Int Array

License

Open Source License

Declaration

public static int[] toIntArray(final byte[] array) 

Method Source Code

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

public class Main {
    public static int[] toIntArray(final byte[] array) {
        return toIntArray(array, 0, array.length);
    }//w w w  . ja va2 s. c o  m

    public static int[] toIntArray(final byte[] array, final int off, final int len) {
        return toIntArray(array, off, len, new int[len], 0);
    }

    public static int[] toIntArray(final byte[] from, final int fromOff, final int len, final int[] to,
            final int toOff) {
        final int end = fromOff + len;

        for (int i = fromOff, j = toOff; i < end; i++, j++) {
            to[j] = from[i];
        }

        return to;
    }

    public static int[] toIntArray(final char[] array) {
        return toIntArray(array, 0, array.length);
    }

    public static int[] toIntArray(final char[] array, final int off, final int len) {
        return toIntArray(array, off, len, new int[len], 0);
    }

    public static int[] toIntArray(final char[] from, final int fromOff, final int len, final int[] to,
            final int toOff) {
        final int end = fromOff + len;

        for (int i = fromOff, j = toOff; i < end; i++, j++) {
            to[j] = from[i];
        }

        return to;
    }

    public static int[] toIntArray(final short[] array) {
        return toIntArray(array, 0, array.length);
    }

    public static int[] toIntArray(final short[] array, final int off, final int len) {
        return toIntArray(array, off, len, new int[len], 0);
    }

    public static int[] toIntArray(final short[] from, final int fromOff, final int len, final int[] to,
            final int toOff) {
        final int end = fromOff + len;

        for (int i = fromOff, j = toOff; i < end; i++, j++) {
            to[j] = from[i];
        }

        return to;
    }

    public static int[] toIntArray(final long[] array) {
        return toIntArray(array, 0, array.length);
    }

    public static int[] toIntArray(final long[] array, final int off, final int len) {
        return toIntArray(array, off, len, new int[len], 0);
    }

    public static int[] toIntArray(final long[] from, final int fromOff, final int len, final int[] to,
            final int toOff) {
        final int end = fromOff + len;

        for (int i = fromOff, j = toOff; i < end; i++, j++) {
            to[j] = (int) from[i];
        }

        return to;
    }

    public static int[] toIntArray(final float[] array) {
        return toIntArray(array, 0, array.length);
    }

    public static int[] toIntArray(final float[] array, final int off, final int len) {
        return toIntArray(array, off, len, new int[len], 0);
    }

    public static int[] toIntArray(final float[] from, final int fromOff, final int len, final int[] to,
            final int toOff) {
        final int end = fromOff + len;

        for (int i = fromOff, j = toOff; i < end; i++, j++) {
            to[j] = (int) from[i];
        }

        return to;
    }

    public static int[] toIntArray(final double[] array) {
        return toIntArray(array, 0, array.length);
    }

    public static int[] toIntArray(final double[] array, final int off, final int len) {
        return toIntArray(array, off, len, new int[len], 0);
    }

    public static int[] toIntArray(final double[] from, final int fromOff, final int len, final int[] to,
            final int toOff) {
        final int end = fromOff + len;

        for (int i = fromOff, j = toOff; i < end; i++, j++) {
            to[j] = (int) from[i];
        }

        return to;
    }
}

Related

  1. toIntArray(byte[] data, boolean includeLength)
  2. toIntArray(byte[] data, int offset)
  3. toIntArray(byte[] input)
  4. toIntArray(double[] a)
  5. toIntArray(double[] array)
  6. toIntArray(final byte[] bytes)
  7. toIntArray(final double[] doubleArray)
  8. toIntArray(final int ip)
  9. toIntArray(final Object[] array)