Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Wed, 17 Aug 2011 20:07:20 -0500 Date: Wed, 17 Aug 2011 18:07:09 -0700 From: Patricia Shanahan User-Agent: Mozilla/5.0 (Windows NT 5.2; WOW64; rv:5.0) Gecko/20110624 Thunderbird/5.0 MIME-Version: 1.0 Newsgroups: comp.lang.java.programmer Subject: Re: Using Enumerated Types as Array Indexes References: <4e4b0d81$0$314$14726298@news.sunsite.dk> <4e4b1fe4$0$314$14726298@news.sunsite.dk> <6d418cda-dab3-43df-a9ec-293b43f2bbd8@glegroupsg2000goo.googlegroups.com> <9b2aglFuj7U1@mid.individual.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <__-dnaxcSIRV-NHTnZ2dnUVZ_tOdnZ2d@earthlink.com> Lines: 10 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 70.230.203.65 X-Trace: sv3-pqjWqf7yRZeYZgikK4FCVMNpjHW9SFHiJja0/dFpjRRZJXNXKL4dCsCUcl1ew3qXU07oikFAanhq8/C!8YY3iCsIVoyemSTFipgTkFsXmEF7lnG/TtRA9vYS6KxPYqcr7XbheXYIlEvcKXB4liUkenWHIubp!DbqHf2HsivgRJIFUPxdWa3WF+1Tbx6WWCfaxPMH7VgrlBg== X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2053 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:7186 On 8/17/2011 4:48 PM, Andreas Leitgeb wrote: ... > Rather: arr[ (n%arr.length + arr.length) % arr.length ] I believe the root cause of the problem may have been thinking of % as a modulo operator when it is really the remainder operator. Has any thought been given to create Math.mod, for both int and long, with implementation as above? Patricia