About 50 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. 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 …

  3. 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, …

  4. 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 …

  5. 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 …

  6. 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 …

  7. loops - java maximum value of int - Stack Overflow

    Sep 28, 2013 · As per my knowledge ++i should increment the value of i by 1 and throw exception, because 2147483648 is not allowed in int. Your understanding is incorrect. Integer arithmetic …

  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. 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 …

  10. 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 …