Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Arrays;
- public class Halting {
- public static void main(String[] args){
- byte[] bytes = new byte[0];
- while (true){
- boolean carry = true;
- int i = 0;
- while (carry){
- if (i == bytes.length){
- bytes = Arrays.copyOf(bytes,i+1);
- break;
- }
- int a = bytes[i] + 1;
- carry = a==256;
- bytes[i] = (byte) (a+1);
- i++;
- }
- byte[] code = Arrays.copyOf(bytes, bytes.length);
- new Thread(() -> {
- try{
- new MyClassLoader().loadClass(code).getMethod("main",String[].class).invoke(null,new String[0]);
- System.out.println(Arrays.toString(code));
- } catch (Throwable e){}
- }).start();
- }
- }
- static class MyClassLoader extends ClassLoader{
- Class loadClass(byte[] bytes){
- return this.defineClass(bytes, 0, bytes.length);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement