private static String createString(byte data[]){
  StringBuilder sb=new StringBuilder();
  for (int i=0; i < data.length; i++) {
    if (data[i] == 0) {
      break;
    }
    sb.append((char)data[i]);
  }
  String result=sb.toString();
  return result;
}

private static String createString ( byte data [ ] ) { StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < data . length ; i ++ ) { if ( data [ i ] == 0 ) { break ; } sb . append ( ( char ) data [ i ] ) ; } String result = sb . toString ( ) ; return result ; }
converts the given byte array into a string . the characters of the given data are connected to a string , until a terminating ' \ 0 ' character is encountered .
