Last active
April 8, 2024 13:36
-
-
Save bzdgn/78b6f92b391650a48c50 to your computer and use it in GitHub Desktop.
Dummy Code Generator : 10000 Lines of Useless Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.FileNotFoundException; | |
import java.io.PrintWriter; | |
public class GenerateDummyCode { | |
public static void main(String[] args) { | |
String className = "Eben"; | |
String newLine = "\n"; | |
String tab = "\t"; | |
String classStart = "public class " + className + " {"; | |
String closeBracket = "}"; | |
String mainStart = "public static void main(String[] args) {"; | |
String dummyContent = ""; | |
String temp = null; | |
int size = 10000; | |
for (int i = 1; i <= size; i++) { | |
temp = String.format("System.out.println(\" %6d .ci satir\");", i); | |
dummyContent += tab + tab + temp + newLine; | |
} | |
String outputCode = | |
classStart + newLine + newLine + | |
tab + mainStart + newLine + newLine + | |
dummyContent + newLine + | |
tab + closeBracket + newLine + | |
closeBracket + newLine; | |
// System.out.println(result); // To print the output to the console | |
PrintWriter out = null; | |
try { | |
out = new PrintWriter(className + ".java"); | |
} catch (FileNotFoundException e) { | |
System.out.println("File not found!"); | |
} | |
out.println(outputCode); | |
out.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
u