Java - Write code to pad String from Right using String.format()

Requirements

Write code to pad String from Right using String.format()

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        String s = "book2s.com";
        int n = 42;
        System.out.println(padRight(s, n));
    }/*from  w w  w.j av  a 2  s  .c o m*/

    public static String padRight(String s, int n) {
        return String.format("%1$-" + n + "s", s);
    }
}