You need to have a "dictionary" file for your names (that will contain 1:one, 2:two, ...)
Then you'll have to parse that file and create a java file :
public String createFileContent( List<String> variableNames ) {
StringBuffer buffer = new StringBuffer();
for( String name : variableNames ) {
buffer.append( "Example " );
buffer.append( name );
buffer.append( " = new Example();" );
buffer.append("\n");
}
return buffer.toString();
}
For more advanced code generation, you might consider using specialized technologies like https://developers.google.com/closure/templates/ http://www.stringtemplate.org/ or more generic solutions : http://java-source.net/open-source/template-engines