Useless Code For Useless Prizes.
2
Dummy Code Generator
40 lines 1.1 kB View raw
1import java.io.FileNotFoundException; 2import java.io.PrintWriter; 3 4public class GenerateDummyCode { 5 public static void main(String[] args) { 6 String className = "Eben"; 7 String newLine = "\n"; 8 String tab = "\t"; 9 String classStart = "public class " + className + " {"; 10 String closeBracket = "}"; 11 String mainStart = "public static void main(String[] args) {"; 12 String dummyContent = ""; 13 String temp = null; 14 int size = 10000; 15 for (int i = 1; i <= size; i++) { 16 temp = String.format("System.out.println(\" %6d .ci satir\");", i); 17 dummyContent += tab + tab + temp + newLine; 18 } 19 20 String outputCode = 21 classStart + newLine + newLine + 22 tab + mainStart + newLine + newLine + 23 dummyContent + newLine + 24 tab + closeBracket + newLine + 25 closeBracket + newLine; 26 27// System.out.println(result); // To print the output to the console 28 29 PrintWriter out = null; 30 31 try { 32 out = new PrintWriter(className + ".java"); 33 } catch (FileNotFoundException e) { 34 System.out.println("File not found!"); 35 } 36 37 out.println(outputCode); 38 out.close(); 39 } 40}
Sign up or login to add to the discussion