Note that there are some explanatory texts on larger screens.

plurals
  1. POAll possible values of int from the smallest to the largest, using Java
    primarykey
    data
    text
    <p>Write a program to print out all possible values of int data type from the smallest to the largest, using Java.</p> <p><strong>Some notable solutions as of 8th of May 2009, 10:44 GMT:</strong></p> <p>1) Daniel Lew was the first to post <a href="https://stackoverflow.com/questions/835648/all-possible-values-of-int-from-the-smallest-to-the-largest-using-java/835666#835666">correctly working code</a>.</p> <p>2) Kris has provided <a href="https://stackoverflow.com/questions/835648/all-possible-values-of-int-from-the-smallest-to-the-largest-using-java/835841#835841">the simplest solution</a> for the given problem.</p> <p>3) Tom Hawtin - tackline, came up arguably with <a href="https://stackoverflow.com/questions/835648/all-possible-values-of-int-from-the-smallest-to-the-largest-using-java/835926#835926">the most elegant solution</a>.</p> <p>4) mmyers pointed out that printing is likely to become a bottleneck and <a href="https://stackoverflow.com/questions/835648/all-possible-values-of-int-from-the-smallest-to-the-largest-using-java/835681#835681">can be improved through buffering</a>.</p> <p>5) Jay's <a href="https://stackoverflow.com/questions/835648/all-possible-values-of-int-from-the-smallest-to-the-largest-using-java/837436#837436">brute force approach</a> is notable since, besides defying the core point of programming, the resulting source code takes about 128 GB and will blow compiler limits.</p> <p>As a side note I believe that the answers do demonstrate that it could be a good interview question, as long as the emphasis is not on the ability to remember trivia about the data type overflow and its implications (that can be easily spotted during unit testing), or the way of obtaining MAX and MIN limits (can easily be looked up in the documentation) but rather on the analysis of various ways of dealing with the problem.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload