Java tutorial
//package com.java2s; public class Main { private static String camelCase2Upper(String s) { String r = ""; boolean u = false; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); char C = Character.toUpperCase(c); if (Character.isUpperCase(c)) { r = r + (u ? ("_" + C) : C); } else { u = true; r = r + C; } } return r; } }