Squadless
asked on
What is the size of INT in java?
If i have an int counter that counts the number of rows retrieved from an SQL query... would it be ok if the counter is an "int" if the maximum number of rows is 500,000?
What is the size of 'int' in java?
What is the size of 'int' in java?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Integer.MAX_VALUE == 2,147,483,647
yes an int would be fine for that purpose :)
Yes, 'int' variables are represented on 4 bytes and should be suited for counting up more than 500,000 rows. The "int" type allows values from -2147483648 to 2147483647, inclusive.
Alternatively the "long" type is stored in 8 bytes and allows values from -9223372036854775808 to 9223372036854775807, inclusive.
Alternatively the "long" type is stored in 8 bytes and allows values from -9223372036854775808 to 9223372036854775807, inclusive.