@ SuppressWarnings ( "checkstyle:magicnumber" ) void writeLong ( long value ) { if ( value == Long . MIN_VALUE ) { write ( STR_LONG_MIN_VALUE ) ; return ; } if ( value < 0 ) { write ( ' ' ) ; value = - value ; } int digitsWithoutComma = 0 ; tmpSb . setLength ( 0 ) ; do { digitsWithoutComma ++ ; if ( digitsWithoutComma == 4 ) { tmpSb . append ( ' ' ) ; digitsWithoutComma = 1 ; } int mod = ( int ) ( value % 10 ) ; tmpSb . append ( DIGITS [ mod ] ) ; value = value / 10 ; } while ( value > 0 ) ; for ( int k = tmpSb . length ( ) - 1 ; k >= 0 ; k -- ) { char c = tmpSb . charAt ( k ) ; write ( c ) ; } }
we can t rely on NumberFormat since it generates a ton of garbage