Java Char Array Create toCharArray(byte[] barr)

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

Description

Converts byte array to char array.

License

Open Source License

Declaration

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

Method Source Code

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

public class Main {
    /**// w w  w. java2  s.c  o m
     * Converts byte array to char array.
     */
    public static char[] toCharArray(byte[] barr) {
        if (barr == null) {
            return null;
        }
        char[] carr = new char[barr.length];
        for (int i = 0; i < barr.length; i++) {
            carr[i] = (char) barr[i];
        }
        return carr;
    }
}

Related

  1. charArray(int arraySize)
  2. charArrayLiteral(CharSequence cs)
  3. toCharacterArray(String s)
  4. toCharArray(boolean[] array)
  5. toCharArray(byte[] byteArray)
  6. toCharArray(byte[] data)
  7. toCharArray(byte[] input)
  8. toCharArray(byte[] src)