public static String camelCaseToUnderline(String name) {
        final int length = name.length();
        boolean inupper = false;
        StringBuilder stb = new StringBuilder(length);
        int i = 0;
        while (i < length) {
            char c = name.charAt(i);
            i = i + 1;
            if(inupper) {
                if(Character.isLowerCase(c)){
                    stb.append(c);
                    inupper = false;
                }else if(i < length && Character.isUpperCase(c) && Character.isLowerCase(name.charAt(i))){
                    stb.append('_');
                    stb.append(Character.toLowerCase(c));
                    inupper = false;
                }else{
                    stb.append(Character.toLowerCase(c));
                }
            }else{
                if(Character.isUpperCase(c)) {
                    stb.append('_');
                    stb.append(Character.toLowerCase(c));
                    inupper = true;
                }else{
                    stb.append(c);
                }
            }
        }
        return stb.toString();
    }