|
@@ -73,8 +73,14 @@ public final class HelperUtils {
|
|
|
* @return converted String
|
|
|
*/
|
|
|
public static String byteToStr(byte[] bytes) {
|
|
|
- char[] chars = new char[bytes.length];
|
|
|
- for (int i = 0, j = 0; i < bytes.length && j < chars.length; i++) {
|
|
|
+ int size = 0;
|
|
|
+ for(byte b : bytes) {
|
|
|
+ if(isLetter((char) b)) {
|
|
|
+ size++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ char[] chars = new char[size];
|
|
|
+ for (int i = 0, j = 0; i < bytes.length && j < size; i++) {
|
|
|
if (isLetter((char) bytes[i])) {
|
|
|
chars[j] = (char) bytes[i];
|
|
|
j++;
|