Here you can find the source of rightPad(String value, int length)
public static String rightPad(String value, int length)
//package com.java2s; public class Main { public static String rightPad(String value, int length) { StringBuffer buffer = new StringBuffer(value); while (buffer.length() < length) { buffer.append(' '); }//from w ww .j av a2 s . c o m return buffer.toString(); } }