static int adjustConfidence ( int codeUnit , int confidence ) { if ( codeUnit == 0 ) { confidence -= 10 ; } else if ( ( codeUnit >= 0x20 && codeUnit <= 0xff ) || codeUnit == 0x0a ) { confidence += 10 ; } if ( confidence < 0 ) { confidence = 0 ; } else if ( confidence > 100 ) { confidence = 100 ; } return confidence ; }
NULs should be rare in actual text .