Path: csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!nx02.iad01.newshosting.com!newshosting.com!69.16.185.21.MISMATCH!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!f31g2000pri.googlegroups.com!not-for-mail From: Sanny Newsgroups: comp.lang.java.programmer Subject: Re: Java left shift and right shift operators. Date: Tue, 26 Apr 2011 09:46:39 -0700 (PDT) Organization: http://groups.google.com Lines: 20 Message-ID: References: <295e16b3-2ed8-4529-bfb0-1cc26ed93ad6@d26g2000prn.googlegroups.com> <1b558330-ae94-4e4e-9922-a9aeb63eaf37@d19g2000prh.googlegroups.com> NNTP-Posting-Host: 122.168.206.80 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1303836399 11248 127.0.0.1 (26 Apr 2011 16:46:39 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 26 Apr 2011 16:46:39 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: f31g2000pri.googlegroups.com; posting-host=122.168.206.80; posting-account=TwCTWQgAAAC7hf6GV7aTGIk6mVGkiZ5c User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; FDM),gzip(gfe) Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:3274 > > Doesn't matter, the Java operator *is* defined for negative values. > > > So the solution to Sanny's problem is: > > > output =3D n >> shiftBy; > > OK, that is a trick answer because it's wrong. =A0True, the shift operato= r is > defined for negative shift values, but those get masked to positive shift > values regardless and don't give the OP's desired result. I did not get any error when using it but the answer was "0" when I used negative shifts. Maximum value a integer can hold is 64 bit in long variable. I want a even larger number. Can I create a larger number which allows right- shifts and left shifts? by multiplication/ division? Bye Sanny