Advertisement
Guest User

Untitled

a guest
Jun 3rd, 2015
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. import java.util.Arrays;
  2.  
  3. public class Halting {
  4.  
  5. public static void main(String[] args){
  6. byte[] bytes = new byte[0];
  7. while (true){
  8. boolean carry = true;
  9. int i = 0;
  10. while (carry){
  11. if (i == bytes.length){
  12. bytes = Arrays.copyOf(bytes,i+1);
  13. break;
  14. }
  15. int a = bytes[i] + 1;
  16. carry = a==256;
  17. bytes[i] = (byte) (a+1);
  18. i++;
  19. }
  20. byte[] code = Arrays.copyOf(bytes, bytes.length);
  21. new Thread(() -> {
  22. try{
  23. new MyClassLoader().loadClass(code).getMethod("main",String[].class).invoke(null,new String[0]);
  24. System.out.println(Arrays.toString(code));
  25. } catch (Throwable e){}
  26. }).start();
  27. }
  28. }
  29.  
  30. static class MyClassLoader extends ClassLoader{
  31. Class loadClass(byte[] bytes){
  32. return this.defineClass(bytes, 0, bytes.length);
  33. }
  34. }
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement