public static String Rpad( String valueToPad, String filler, int size ) {
    if ( ( size == 0 ) || ( valueToPad == null ) || ( filler == null ) ) {
      return valueToPad;
    }
    int vSize = valueToPad.length();
    int fSize = filler.length();
    // This next if ensures previous behavior, but prevents infinite loop
    // if "" is passed in as a filler.
    if ( ( vSize >= size ) || ( fSize == 0 )  ) {
      return valueToPad;
    }
    int tgt = ( size - vSize );
    StringBuilder sb1 = new StringBuilder( size );
    sb1.append( filler );
    while ( sb1.length() < tgt ) {
      // instead of adding one character at a time, this
      // is exponential - much fewer times in loop
      sb1.append( sb1 );
    }
    StringBuilder sb = new StringBuilder( valueToPad );
    sb.append( sb1 );
    return sb.substring( 0, size );
  }
@Test
  public void testRpad() {
    final String s = "pad me";
    assertEquals( s, Const.Rpad( s, "-", 0 ) );
    assertEquals( s, Const.Rpad( s, "-", 3 ) );
    assertEquals( s + "--", Const.Rpad( s, "-", 8 ) );
    // add in some edge cases
    assertEquals( s, Const.Rpad( s, null, 15 ) ); // No NPE
    assertEquals( s, Const.Rpad( s, "", 15 ) );
    assertEquals( s, Const.Rpad( s, "*", 5 ) );
    assertEquals( null, Const.Rpad( null, "*", 15 ) );
    assertEquals( "Test****", Const.Rpad( "Test", "**********", 8 ) );
    assertEquals( "Test*", Const.Rpad( "Test", "**", 5 ) );
    assertEquals( "****", Const.Rpad( "", "*", 4 ) );
  }