public static String formatNameForClassLoading(String name){
  if (name == null) {
    return "java.lang.Object;";
  }
  if (name.equals("int") || name.equals("long") || name.equals("short")|| name.equals("float")|| name.equals("double")|| name.equals("byte")|| name.equals("char")|| name.equals("boolean")|| name.equals("void")) {
    return name;
  }
  if (name.startsWith("[")) {
    return name.replace('/','.');
  }
  if (name.startsWith("L")) {
    name=name.substring(1);
    if (name.endsWith(";")) {
      name=name.substring(0,name.length() - 1);
    }
    return name.replace('/','.');
  }
  String prefix="";
  if (name.endsWith("[]")) {
    prefix="[";
    name=name.substring(0,name.length() - 2);
    if (name.equals("int")) {
      return prefix + "I";
    }
 else     if (name.equals("long")) {
      return prefix + "J";
    }
 else     if (name.equals("short")) {
      return prefix + "S";
    }
 else     if (name.equals("float")) {
      return prefix + "F";
    }
 else     if (name.equals("double")) {
      return prefix + "D";
    }
 else     if (name.equals("byte")) {
      return prefix + "B";
    }
 else     if (name.equals("char")) {
      return prefix + "C";
    }
 else     if (name.equals("boolean")) {
      return prefix + "Z";
    }
 else {
      return prefix + "L" + name.replace('/','.')+ ";";
    }
  }
  return name.replace('/','.');
}

public static String formatNameForClassLoading ( String name ) { if ( name == null ) { return "java.lang.Object;" ; } if ( name . equals ( "int" ) || name . equals ( "long" ) || name . equals ( "short" ) || name . equals ( "float" ) || name . equals ( "double" ) || name . equals ( "byte" ) || name . equals ( "char" ) || name . equals ( "boolean" ) || name . equals ( "void" ) ) { return name ; } if ( name . startsWith ( "[" ) ) { return name . replace ( '/' , '.' ) ; } if ( name . startsWith ( "L" ) ) { name = name . substring ( 1 ) ; if ( name . endsWith ( ";" ) ) { name = name . substring ( 0 , name . length ( ) - 1 ) ; } return name . replace ( '/' , '.' ) ; } String prefix = "" ; if ( name . endsWith ( "[]" ) ) { prefix = "[" ; name = name . substring ( 0 , name . length ( ) - 2 ) ; if ( name . equals ( "int" ) ) { return prefix + "I" ; } else if ( name . equals ( "long" ) ) { return prefix + "J" ; } else if ( name . equals ( "short" ) ) { return prefix + "S" ; } else if ( name . equals ( "float" ) ) { return prefix + "F" ; } else if ( name . equals ( "double" ) ) { return prefix + "D" ; } else if ( name . equals ( "byte" ) ) { return prefix + "B" ; } else if ( name . equals ( "char" ) ) { return prefix + "C" ; } else if ( name . equals ( "boolean" ) ) { return prefix + "Z" ; } else { return prefix + "L" + name . replace ( '/' , '.' ) + ";" ; } } return name . replace ( '/' , '.' ) ; }
returns a name that class . forname ( ) can take . notably for arrays : [ i , [ ljava . lang . string ; etc regular object type : java . lang . string
