Java Char Array Create toCharArray(final byte[] array)

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

Description

to Char Array

License

Open Source License

Declaration

public static char[] toCharArray(final byte[] array) 

Method Source Code

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

public class Main {
    public static char[] toCharArray(final byte[] array) {
        return toCharArray(array, 0, array.length);
    }/*from  w w w  .  j  a v  a 2s.c  o m*/

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

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

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

        return to;
    }

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

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

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

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

        return to;
    }

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

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

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

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

        return to;
    }

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

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

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

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

        return to;
    }

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

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

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

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

        return to;
    }

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

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

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

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

        return to;
    }
}

Related

  1. toCharArray(CharSequence chars)
  2. toCharArray(CharSequence charSequence)
  3. toCharArray(CharSequence charSequence)
  4. toCharArray(CharSequence cs)
  5. toCharArray(double[][] array)
  6. toCharArray(int number, int exactArrayLength)
  7. toCharArray(String map)
  8. toCharArray(String s)
  9. toCharArray(String s)