import java.util.Scanner;
class HammingCode
static void printint ar
for int i ; i arlength; i
System.out.printari;
System.out.println;
static int calculationint ar int r
for int i ; i r; i
int x int Math.pow i;
for int j ; j arlength; j
if j i &
if x j
arx arx arj;
System.out.printlnp x arx;
return ar;
static int generateCodeString str int M int r
int ar new intr M ;
int j ;
for int i ; i arlength; i
if MathceilMathlogi Math.log
Math.floorMathlogi Math.log
ari;
else
ariintstrcharAtj;
j;
return ar;
public static void mainString args
Scanner scanner new ScannerSystemin;
Input message from the user
System.out.printEnter Data: ;
String str scanner.nextLine;
int M strlength;
int k ;
K M K
while Math.pow kM k
k;
int ar generateCodestr M k;
System.out.printlnGenerated hamming code ;
ar calculationar k;
printar;
scanner.close;
you must do this hamming code with random noise error
you must calculate the percentage of correcting error single bit error, burst error you must do it to check and correct large data