public static String rtrim( String source ) {
    if ( source == null ) {
      return null;
    }

    int max = source.length();
    while ( max > 0 && isSpace( source.charAt( max - 1 ) ) ) {
      max--;
    }

    return source.substring( 0, max );
  }
@Test
  public void testRtrim() {
    assertEquals( null, Const.rtrim( null ) );
    assertEquals( "", Const.rtrim( "" ) );
    assertEquals( "", Const.rtrim( "  " ) );
    assertEquals( "test", Const.rtrim( "test " ) );
    assertEquals( "test ", Const.ltrim( "  test " ) );
  }