try this BigInteger bi = new BigInteger("2"); BigInteger or = new BigInteger("2"); for (int i=1;i<127;i++) { or = or.multiply(bi); } or = or.divide(new BigInteger("3")); for (int i=0;i<3;i++) { System.out.println(or.multiply(new BigInteger(""+i))); }
which generate 0 56713727820156410577229101238628035242 113427455640312821154458202477256070484 Regards, Chen www.evidentsoftware.com On Fri, Feb 18, 2011 at 4:24 PM, Eric Gilmore <e...@datastax.com> wrote: > I'm not sure I can say exactly why, but I'm sure those numbers can't be > correct. One node should be zero and the other values should be very long > numbers like 85070591730234615865843651857942052863. > > We need another Java expert's opinion here, but it looks like your snippet > may have "integer > overflow<http://www.mkyong.com/java/javas-silent-killer-buffer-overflow-careful/>" > or "integer overload" going on. > > > On Fri, Feb 18, 2011 at 1:04 PM, mcasandra <mohitanch...@gmail.com> wrote: > >> >> Thanks! This is what I got. Is this right? >> >> public class TokenCalc{ >> public static void main(String ...args){ >> int nodes=3; >> for(int i = 1 ; i <= nodes; i++) { >> System.out.println( (2 ^ 127) / nodes * i); >> } >> } >> } >> >> 41 >> 82 >> 123 >> -- >> View this message in context: >> http://cassandra-user-incubator-apache-org.3065146.n2.nabble.com/Error-when-bringing-up-3rd-node-tp6041409p6041471.html >> Sent from the cassandra-u...@incubator.apache.org mailing list archive at >> Nabble.com. >> > >