public static void indent ( int num , StringBuilder out ) { if ( num <= SIXTY_FOUR ) { out . append ( SIXTY_FOUR_SPACES , 0 , num ) ; return ; } else if ( num <= 128 ) { // avoid initializing loop counters if only one iteration out . append ( SIXTY_FOUR_SPACES , 0 , SIXTY_FOUR ) ; out . append ( SIXTY_FOUR_SPACES , 0 , num - SIXTY_FOUR ) ; } else { int times = num / SIXTY_FOUR ; int rem = num % SIXTY_FOUR ; for ( int i = 0 ; i < times ; i ++ ) { out . append ( SIXTY_FOUR_SPACES , 0 , SIXTY_FOUR ) ; } out . append ( SIXTY_FOUR_SPACES , 0 , rem ) ; return ; } }
Write a number of whitespaces to a StringBuffer