public static String removeNullPadding ( String str ) { int idx = str . indexOf ( 0 ) ; if ( idx == - 1 ) { return str ; } return str . substring ( 0 , idx ) ; }
Strips off any null padding if any from the string