Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Arrays;

public class Main {
    public static String prependString(String str, int len) {
        try {
            char[] tmp = new char[len - str.length()];
            Arrays.fill(tmp, ' ');
            return new String(tmp) + str;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return str;
    }
}