Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static String lpad(String str, int length, String ch) {
        str = (str == null) ? "" : str;
        StringBuffer buf = new StringBuffer();
        int idx = str.length();
        while (idx < length) {
            buf.append(ch);
            idx++;
        }
        buf.append(str);
        return buf.toString();
    }
}