code: private static String toVariableName(String str) {
  
  	StringBuffer rtn = new StringBuffer();
  	char[] chars = str.toCharArray();
  	long changes = 0;
  	boolean doCorrect = true;
  	for (int i = 0; i < chars.length; i++) {
  	    char c = chars[i];
  	    if (i == 0 && (c >= '0' && c <= '9')) rtn.append("_" + c);
  	    else if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_' || c == '$') rtn.append(c);
  	    else {
  		doCorrect = false;
  		rtn.append('_');
  		changes += (c * (i + 1));
  	    }
  	}
  
  	if (changes > 0) rtn.append(changes);
  
  	if (doCorrect) return correctReservedWord(rtn.toString());
  	return rtn.toString();
      }
docs: translate a string to a valid variable string
  
  @param str string to translate
  @return translated String