Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.Arrays; public class Main { static String rjust(String string, char padding, int length) { if (string == null) { return null; } int paddingNum = length - string.length(); if (paddingNum < 1) { return string; } char[] pads = new char[paddingNum]; Arrays.fill(pads, padding); return new String(pads) + string; } }