private static void repeat(String pattern,int count,Appendable out) throws IOException {
  while (count >= pattern.length()) {
    out.append(pattern);
    count-=pattern.length();
  }
  if (count > 0) {
    out.append(pattern,0,count);
  }
}

private static void repeat ( String pattern , int count , Appendable out ) throws IOException { while ( count >= pattern . length ( ) ) { out . append ( pattern ) ; count -= pattern . length ( ) ; } if ( count > 0 ) { out . append ( pattern , 0 , count ) ; } }
append count characters from pattern onto out , repeating if necessary .
