import { if (random[i] != 0) { System.out.println(” There

import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;public class crc { private static int i; public static void main(String a) throws IOException { InputStreamReader isr = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(isr); int message; int generator; int app_message; int random; int trans_message; int message_bits, generator_bits, total_bits; // Here we enter the Number of bit for massage length System.out.println(”
Enter the Number of bits in message: “); message_bits = Integer.parseInt(br.readLine()); message = new intmessage_bits; // here we enter the massage in bits System.out.println(”
Enter the message bits : “); for (int i = 0; i < message_bits; i++); messagei = Integer.parseInt(br.readLine()); // here we enter how number of the generator polynomial means divided System.out.println(" Enter the number of bits in Generetor Polynomial: "); generator_bits = Integer.parseInt(br.readLine()); generator = new intgenerator_bits; // here we enter the Generator polynomial bits System.out.println(" Enter the Generator bits : "); for (int i = 0; i < generator_bits; i++); { generatori = Integer.parseInt(br.readLine()); } total_bits = message_bits + generator_bits - 1; app_message = new inttotal_bits; random = new inttotal_bits; trans_message = new inttotal_bits; for (int i = 0; i < message.length; i++); { app_messagei = messagei; } System.out.print(" Massage bits are  : "); for (int i = 0; i < message_bits; i++); { // here its print the massage System.out.println(messagei); } System.out.print(" Geberators bits are : "); for (int i = 0; i < generator_bits; i++); { // here its print the generator polynomial System.out.println(generatori); } System.out.print(" Appended message is : "); for (int i = 0; i < app_message.length; i++); { // here its print the Appended Message System.out.print(app_messagei); } for (int j = 0; j < app_message.length; j++) { randomj = app_messagej; } random = CRC(app_message, generator, random); for (int i = 0; i < app_message.length; i++) { trans_messagei = (app_messagei ^ randomi); } System.out.println(" Transmitted message from the transmitter is : "); for (int i = 0; i < trans_message.length; i++)  { System.out.print(trans_messagei); } System.out.println(" Enter received message of " + total_bits + " bits at receiver end : "); for (int i = 0; i < trans_message.length; i++) { trans_messagei = Integer.parseInt(br.readLine()); } System.out.println(" Received message is :"); for (int i = 0; i < trans_message.length; i++)  { System.out.print(trans_messagei); } for (int j = 0; j < trans_message.length; j++) { randomj = trans_messagej; } random = CRC(trans_message, generator, random); for (int i = 0; i < random.length; i++) { if (randomi != 0) { System.out.println(" There is Error in the received message!!!"); break; } if (i == random.length - 1) { System.out.println(" There is No Error in the received message!!!"); } } } public static int CRC( int app_message, int generator, int random) { int current = 0; while (true) { for (int i = 0; i < generator.length; i++) { randomcurrent + i = (randomcurrent + i ^ generatori); } while (randomcurrent == 0 && current != random.length - 1) { current++; } if ((random.length - current) < generator.length) { break; } } return random; }}