Java Char Array Create toCharArray(byte[] input)

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

Description

Rewrite a byte array as a char array

License

Open Source License

Parameter

Parameter Description
input - the byte array

Return

char array

Declaration

public static char[] toCharArray(byte[] input) 

Method Source Code

//package com.java2s;

public class Main {
    /**//w  ww .ja v a  2  s  .  co m
     * Rewrite a byte array as a char array
     *
     * @param input -
     *              the byte array
     * @return char array
     */
    public static char[] toCharArray(byte[] input) {
        char[] result = new char[input.length];
        for (int i = 0; i < input.length; i++) {
            result[i] = (char) input[i];
        }
        return result;
    }
}

Related

  1. toCharacterArray(String s)
  2. toCharArray(boolean[] array)
  3. toCharArray(byte[] barr)
  4. toCharArray(byte[] byteArray)
  5. toCharArray(byte[] data)
  6. toCharArray(byte[] src)
  7. toCharArray(char... values)
  8. toCharArray(CharSequence chars)
  9. toCharArray(CharSequence charSequence)