Question
Please help me fix my CRC java code. I don't know why its giving me wrong answers. import java.util.*; import java.lang.*; import java.lang.Number; import java.math.BigInteger;
Please help me fix my CRC java code. I don't know why its giving me wrong answers.
import java.util.*; import java.lang.*; import java.lang.Number; import java.math.BigInteger; public class CyclicRedundancyCheck { public static void main(String[] args) throws NumberFormatException { Scanner sc = new Scanner(System.in); System.out.println("Please make sure all data being entered is in binary form (ie 101101)"); System.out.println(" "); System.out.print("Enter your Row Information Code: "); String code = sc.next(); System.out.println(" "); System.out.print("Enter the polynomial: "); String polynomial = sc.next(); System.out.println(" ");
// Ammount of 0's to be appended int r = (polynomial.length()); String newcode = code; for(int i=1; i //C is our check value BigInteger C = new BigInteger("0",2); System.out.println("The check sum is = " + (R.toString(2))); //Check to see if remainder is 0 if (R.equals(C)) { System.out.println("Checksum is zero, therefore, no transmission error"); } else { System.out.println("Checksum is not zero, therefore, some transmission error occurred"); } } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started