code: public static String pad( String s, int length )
  	{
  		// Trim if longer...
  		if( s.length() > length )
  		{
  			return s.substring( 0, length );
  		}
  		StringBuffer buffer = new StringBuffer(s);
  		int spaces = length - s.length();
  		while( spaces-- > 0 )
  		{
  			buffer.append(' ');
  		}
  		return buffer.toString();
  	}
docs: Pad the specified <tt>String</tt> with spaces on the right-hand side.
  
  @param s       String to add spaces
  @param length  Desired length of string after padding
  
  @return padded string.