private static String byteArrayToString(byte[] array){
  if (array != null) {
    String temString=new String(array);
    if (temString != null) {
      return temString.substring(0,temString.length() - 1);
    }
  }
  return null;
}

private static String byteArrayToString ( byte [ ] array ) { if ( array != null ) { String temString = new String ( array ) ; if ( temString != null ) { return temString . substring ( 0 , temString . length ( ) - 1 ) ; } } return null ; }
converts a null - terminated byte array to java string
