Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

public class Main {

    public static String insertSpace(String str) {
        String chr;
        StringBuffer buffer = new StringBuffer();
        for (int i = 0; i < str.length(); i++) {
            chr = String.valueOf(str.charAt(i));
            if ((i > 0) && (chr.matches("[A-Z]")))
                buffer.append(" ");
            buffer.append(chr);
        }
        return buffer.toString();
    }
}