Java Float Array Create toFloatArray(final byte[] array)

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

Description

to Float Array

License

Open Source License

Declaration

public static float[] toFloatArray(final byte[] array) 

Method Source Code

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

public class Main {
    public static float[] toFloatArray(final byte[] array) {
        return toFloatArray(array, 0, array.length);
    }//  w w w  .j a va2 s  . co m

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

    public static float[] toFloatArray(final byte[] from, final int fromOff, final int len, final float[] 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 float[] toFloatArray(final char[] array) {
        return toFloatArray(array, 0, array.length);
    }

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

    public static float[] toFloatArray(final char[] from, final int fromOff, final int len, final float[] 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 float[] toFloatArray(final short[] array) {
        return toFloatArray(array, 0, array.length);
    }

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

    public static float[] toFloatArray(final short[] from, final int fromOff, final int len, final float[] 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 float[] toFloatArray(final int[] array) {
        return toFloatArray(array, 0, array.length);
    }

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

    public static float[] toFloatArray(final int[] from, final int fromOff, final int len, final float[] 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 float[] toFloatArray(final long[] array) {
        return toFloatArray(array, 0, array.length);
    }

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

    public static float[] toFloatArray(final long[] from, final int fromOff, final int len, final float[] 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 float[] toFloatArray(final double[] array) {
        return toFloatArray(array, 0, array.length);
    }

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

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

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

        return to;
    }
}

Related

  1. toFloatArray(byte[] byteArray)
  2. toFloatArray(byte[] data)
  3. toFloatArray(byte[] data)
  4. toFloatArray(double[] doubleArray)
  5. toFloatArray(double[][] array)
  6. toFloatArray(final double[] doubleArray)
  7. toFloatArray(final Object[] array)
  8. toFloatArray(Float[] data)
  9. toFloatArray(Number[] array)