Also, ^ means xor in Java, not exponentiation. Just use the Python Eric linked. :)
On Fri, Feb 18, 2011 at 3:24 PM, Ching-Cheng Chen <cc...@evidentsoftware.com> wrote: > 41 > 82 > 123 > These certainly not correct. Can't just use 2 ^ 127, will overflow > You can't use Java's primitive type to do this calculation. long only use > 64 bit. > You'd need to use BigInteger class to do this calculation. > Regards, > Chen > www.evidentsoftware.com > > On Fri, Feb 18, 2011 at 4: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. > > -- Jonathan Ellis Project Chair, Apache Cassandra co-founder of DataStax, the source for professional Cassandra support http://www.datastax.com