Skip to content

Instantly share code, notes, and snippets.

@bzdgn
Last active April 8, 2024 13:36
Show Gist options
  • Save bzdgn/78b6f92b391650a48c50 to your computer and use it in GitHub Desktop.
Save bzdgn/78b6f92b391650a48c50 to your computer and use it in GitHub Desktop.
Dummy Code Generator : 10000 Lines of Useless Code
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();
}
}
@bzdgn
Copy link
Author

bzdgn commented Dec 1, 2015

@emrekekec
Copy link

Dear bzgdn,

If Eben.java file is not found, you will receive a NullPointerException inside stream writer since you are swallowing the Exception and trying to access an unitialized object on the heap.

Keep up the good work, you are almost there

Best Regards

@vghfr
Copy link

vghfr commented Nov 23, 2021

yoink! that's mine now, need filler code

@c-dawkins
Copy link

u

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment