Integer.MAX_VALUE == 2,147,483,647
Main Topics
Browse All TopicsIf 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?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
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.
Business Accounts
Answer for Membership
by: CPColinPosted on 2007-05-07 at 14:04:45ID: 19045981
In Java, an int is 32 bits and signed, so you'll be good up until around two billion (2,000,000,000) rows. If you hit that limit, you can use a long without too much trouble.