Prev: instructor solution manual for Dynamics of Flight- Stability and Control, 3rd Ed by Etkin, Reid
Next: Supply AFF CAPS and hat ( www.nike-black.com )
From: Mike Schilling on 9 Jul 2010 02:07 "Arne Vajh�j" <arne(a)vajhoej.dk> wrote in message news:4c366580$0$280$14726298(a)news.sunsite.dk... > On 08-07-2010 17:15, Lew wrote: >> From the JLS, which I strongly urge you to study: > > Unless the poster has a solid programming experience, > then the JLS may not be the best to study. > > Sure it is by definition correct, mod typos and misstatements, of course. > but it is written > to be detailed and correct not to be easy to read.
From: Roedy Green on 9 Jul 2010 04:14 On Thu, 8 Jul 2010 21:30:30 +0100, "Boris Punk" <khgfhf(a)hmjggg.com> wrote, quoted or indirectly quoted someone who said : >long size = Integer.MAX_VALUE+1; >byte [] b = new byte[size]; > >-possible loss of precision > >How can we make an array of long size? Longs are 64 bits. So if you want a byte array big enough to contain a long, you need new byte[8]. Arrays can only be indexed by ints, not longs. Even if they were, even Bill Gates could not afford enough RAM for an array of bytes, one for each possible long. -- Roedy Green Canadian Mind Products http://mindprod.com You encapsulate not just to save typing, but more importantly, to make it easy and safe to change the code later, since you then need change the logic in only one place. Without it, you might fail to change the logic in all the places it occurs.
From: Patricia Shanahan on 9 Jul 2010 08:14 Roedy Green wrote: > On Thu, 8 Jul 2010 21:30:30 +0100, "Boris Punk" <khgfhf(a)hmjggg.com> > wrote, quoted or indirectly quoted someone who said : > >> long size = Integer.MAX_VALUE+1; >> byte [] b = new byte[size]; >> >> -possible loss of precision >> >> How can we make an array of long size? > > Longs are 64 bits. So if you want a byte array big enough to contain > a long, you need new byte[8]. > > Arrays can only be indexed by ints, not longs. Even if they were, > even Bill Gates could not afford enough RAM for an array of bytes, one > for each possible long. No, but many of us own computers on which one could have a byte[] bigger than can be indexed by an int. Since Java has no integer type with a range between that of int and long, if int is not big enough we need long. Patricia
From: Eric Sosman on 9 Jul 2010 08:15 On 7/8/2010 9:11 PM, Patricia Shanahan wrote: > Arne Vajh�j wrote: >> On 08-07-2010 17:35, Boris Punk wrote: >>> Integer.MAX_VALUE = 2147483647 >>> >>> I might need more items than that. I probably won't, but it's nice to >>> have >>> extensibility. >> >> It is a lot of data. >> >> I think you should assume YAGNI. > > > Historically, each memory size has gone through a sequence of stages: > > 1. Nobody will ever need more than X bytes. > > 2. Some people do need to run multiple jobs that need a total of more > than X bytes, but no one job could possibly need that much. > > 3. Some jobs do need more than X bytes, but no one data structure could > possibly need that much. > > 4. Some data structures do need more than X bytes. > > Any particular reason to believe 32 bit addressing will stick at stage > 3, and not follow the normal progression to stage 4? None. But Java's int isn't going to grow wider, nor will the type of an array's .length suddenly become non-int; too much code would break. When Java reaches the 31-bit wall, I doubt it will find any convenient door; Java's descendants may pass through, but I think Java will remain stuck on this side. In ten years, we'll all have jobs converting "legacy Java code" to Sumatra. -- Eric Sosman esosman(a)ieee-dot-org.invalid
From: Eric Sosman on 9 Jul 2010 08:49
On 7/9/2010 4:14 AM, Roedy Green wrote: > On Thu, 8 Jul 2010 21:30:30 +0100, "Boris Punk"<khgfhf(a)hmjggg.com> > wrote, quoted or indirectly quoted someone who said : > >> long size = Integer.MAX_VALUE+1; >> byte [] b = new byte[size]; >> >> -possible loss of precision >> >> How can we make an array of long size? > > Longs are 64 bits. So if you want a byte array big enough to contain > a long, you need new byte[8]. > > Arrays can only be indexed by ints, not longs. Even if they were, > even Bill Gates could not afford enough RAM for an array of bytes, one > for each possible long. True, but not especially relevant: You'll hit the int limit long before running out of dollars. $50US will buy more RAM than a Java byte[] can use. -- Eric Sosman esosman(a)ieee-dot-org.invalid |