Finding the remainder in binary division.

I am trying to calculate a frame check sequence from the following binary strings:

String firstString ="110101"

String secondString ="101000110100000"

By doing:

long remainder = Long.parseLong(secondString) % Long.parseLong(firstString);

System.out.println(remainder +"remainder");

Which gives me the result as a long (surprise surprise :P ).

Is there a way to tell java to return the binary remainder 01110 ?

thanks for having a read again!!

[608 byte] By [blottersa] at [2007-10-2 20:26:22]
# 1
I guess my real problem is how to handle binaries without java messing with them......:'(
blottersa at 2007-7-13 23:09:20 > top of Java-index,Java Essentials,New To Java...
# 2
Hey,That code looks good. You just need to return the long as binary again.You can do this by using:System.out.println(Long.toBinaryString(remainder) + "remainder");
joejaga at 2007-7-13 23:09:20 > top of Java-index,Java Essentials,New To Java...
# 3
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Long.html#toBinaryString(long)~
yawmarka at 2007-7-13 23:09:20 > top of Java-index,Java Essentials,New To Java...