DulcetAirman

new SomeClass[Integer.MAX_VALUE - 5];

May 21st, 2018
71
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package ch.claude_martin;
  2.  
  3. public class SomeClass {
  4.     public static void main(String[] args) {
  5.     var data = new SomeClass[Integer.MAX_VALUE - 5];
  6.     for (long i = 42; i < data.length; i *= Short.MAX_VALUE) {
  7.         data[(int) i] = new SomeClass();
  8.     }
  9.     System.out.println(data.length);
  10.     System.out.println("success");
  11.     }
  12. }
RAW Paste Data