Here you can find the source of charsToString(char[] chars)
Parameter | Description |
---|---|
chars | a parameter |
public static String charsToString(char[] chars)
//package com.java2s; //License from project: Apache License public class Main { /**/*from w ww. j ava 2s .co m*/ * Converts a binary zero terminated char-array to a string. * * @param chars * @return */ public static String charsToString(char[] chars) { int lastBinZero = chars.length - 1; while (lastBinZero >= 0 && chars[lastBinZero] == 0) { lastBinZero--; } return new String(chars, 0, lastBinZero + 1); } }