public static String makeSpaceOfUpperCase(String str) {
        if (str == null || str.length() == 0) return str;
        char[] words = str.toCharArray();
        StringBuilder out = new StringBuilder();
        for (int i = 0; i < words.length; i++) {
            if (Character.isUpperCase(words[i])) {
                if (i + 1 < words.length && Character.isLowerCase(words[i + 1]))
                    out.append(" ");
            }
            out.append(words[i]);
        }
        return out.charAt(0) == ' ' ? out.substring(1) : out.toString();
    }