About 671,000 results
Open links in new tab
  1. java - max value of integer - Stack Overflow

    Feb 21, 2013 · To get the max and min values of int in Java, use Integer.MAX_VALUE and Integer.MIN_VALUE

  2. java - why Integer.MAX_VALUE - Stack Overflow

    Feb 22, 2012 · When you add 1 to the max value of a two's complement number you get the min value. Honestly, all integers behaved this way before java existed, and changing this behavior for the Java …

  3. java - What happens when you increment an integer beyond its max …

    Feb 27, 2011 · 59 In Java, what happens when you increment an int (or byte/short/long) beyond it's max value? Does it wrap around to the max negative value? Does AtomicInteger.getAndIncrement() also …

  4. java - Explanation on Integer.MAX_VALUE and Integer.MIN_VALUE to …

    Jun 7, 2015 · I don't seem to understand how Integer.MAX_VALUE and Integer.MIN_VALUE help in finding the min and max value in an array. I understand how this method (pseudocode below) works …

  5. What is the maximum value for an int32? - Stack Overflow

    To get max value you actually have to calculate the sum of 2^n with n from 0 to 31 or simpler 2^32 - 1 and you'll get '4294967295' as max for unsigned int, one less than anticipated. Now do the same with …

  6. How to get the value of Integer.MAX_VALUE in Java without using the ...

    Apr 6, 2014 · This works because the max integer value in binary is all ones, except the top (sign) bit, which is zero. But -1 in twos compliment binary is all ones, so by bit shifting -1 one bit to the right, …

  7. java - Integer min and max values - Stack Overflow

    Jun 16, 2014 · int min = Integer.MIN_VALUE -1; // min is set to Integer.MAX_VALUE by underflow int max = Integer.MAX_VALUE +1; // max is set to Integer.MIN_VALUE by overflow From the Java …

  8. java - Why is 2,147,483,647 the max int value? - Stack Overflow

    May 13, 2018 · Can someone provide me with a detailed explanation of why 2,147,483,647 is the maximum integer value in Java?

  9. data structures - Integer.MAX_VALUE in java - Stack Overflow

    Jan 19, 2016 · I have read about MAX_VALUE and found that a constant can hold a maximum value of 2^31-1. Where is the need to use a MAX_VALUE for any program? I am also confused on this piece …

  10. Finding the max/min value in an array of primitives using Java

    Sep 28, 2009 · 176 You can simply use the new Java 8 Stream s but you have to work with int. The stream method of the utility class Arrays gives you an IntStream on which you can use the min …