Hamming Code (Java)

Problem Definition: Write a program in Java to compute the Hamming Code and detect & correct the error. import java.util.*; class DanHamming { public static void main(String arg[]) { Scanner sc=new Scanner(System.in); System.out.println(“Enter the 7-bit data code”); int d[]=new int[7]; for(int i=0;i<7;i++) { d[i]=sc.nextInt(); } int p[]=new int[4]; p[0]=d[0]^d[1]^d[3]^d[4]^d[6]; p[1]=d[0]^d[2]^d[3]^d[5]^d[6]; p[2]=d[1]^d[2]^d[3]; p[3]=d[4]^d[5]^d[6]; int c[]=new int[11]; System.out.println(“Complete Code Word is “); c[0]=p[0]; c[1]=p[1]; c[2]=d[0]; c[3]=p[2]; c[4]=d[1]; c[5]=d[2]; … Continue reading Hamming Code (Java)