private static String trimAtNull ( final String s ) { final int end = s . indexOf ( ( char ) 0 ) ; return end > - 1 ? s . substring ( 0 , end ) : s ; }
sometimes the usb4java high - level API returns strings which exceed past the null terminator