Here you can find the source of toJavaName(String name)
public static String toJavaName(String name)
//package com.java2s; /*//from w ww . j a v a2s . com * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ public class Main { /** * Replace all illegal Java chars by '_'. */ public static String toJavaName(String name) { if (name.length() > 0) { final StringBuffer result = new StringBuffer(); char ch = name.charAt(0); result.append(Character.isJavaIdentifierStart(ch) ? ch : '_'); final int n = name.length(); for (int i = 1; i < n; i++) { ch = name.charAt(i); result.append(Character.isJavaIdentifierPart(ch) ? ch : '_'); } return result.toString(); } return name; } }