public static String fromNullTerminatedByteArray ( byte [ ] array ) { int stringSize = array . length ; for ( int i = 0 ; i < array . length ; i ++ ) { if ( array [ i ] == 0 ) { stringSize = i ; break ; } } return new String ( array , 0 , stringSize ) ; }
Converts a null - terminated byte array into a string .