Java examples for java.lang:char Array
creating String out of character array.
//package com.java2s; public class Main { public static void main(String[] argv) { char[] inputArray = new char[] { 'b', 'o', 'o', 'k', '2', 's', '.', 'c', 'o', 'm', 'a', '1', }; System.out.println(charArraytoString(inputArray)); }//from w w w . j ava 2 s.c om /*** * charArraytoString(final char[] inputArray) * API helps in creating String out of character array. Character array is scanned only for the available characters and empty characters are ignored. * @param inputArray * @return */ public static String charArraytoString(final char[] inputArray) { String finalResult = new String(); for (char c : inputArray) { if (c != '\u0000') { finalResult = finalResult + ((Character) c).toString(); } } return finalResult; } }