Guest User

Untitled

a guest
Jun 25th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. private static class WrappingСlassNameCache {...}
  2.  
  3. private static class IntegerCache {
  4. static final int low = -128;
  5. static final int high;
  6. static final Integer cache[];
  7.  
  8. static {
  9. // high value may be configured by property
  10. int h = 127;
  11. String integerCacheHighPropValue =
  12. sun.misc.VM.getSavedProperty("java.lang.Integer.IntegerCache.high");
  13. if (integerCacheHighPropValue != null) {
  14. try {
  15. int i = parseInt(integerCacheHighPropValue);
  16. i = Math.max(i, 127);
  17. // Maximum array size is Integer.MAX_VALUE
  18. h = Math.min(i, Integer.MAX_VALUE - (-low) -1);
  19. } catch( NumberFormatException nfe) {
  20. // If the property cannot be parsed into an int, ignore it.
  21. }
  22. }
  23. high = h;
  24.  
  25. cache = new Integer[(high - low) + 1];
  26. int j = low;
  27. for(int k = 0; k < cache.length; k++)
  28. cache[k] = new Integer(j++);
  29.  
  30. // range [-128, 127] must be interned (JLS7 5.1.7)
  31. assert IntegerCache.high >= 127;
  32. }
Add Comment
Please, Sign In to add comment