Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    private static String splitCamelToHuman(final String source) {
        StringBuilder target = new StringBuilder();
        boolean isFirstChar = true;
        for (int i = 0; i < source.length(); i++) {
            Character ch = source.charAt(i);
            if (Character.isUpperCase(ch)) {
                target.append(" ");
                if (isFirstChar) {
                    target.append(ch);
                    isFirstChar = false;
                } else {
                    target.append(Character.toLowerCase(ch));
                }
            } else {
                target.append(ch);
            }
        }
        return target.toString();
    }
}