SHARE
TWEET

new SomeClass[Integer.MAX_VALUE - 5];

DulcetAirman May 21st, 2018 65 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
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top