import java.util
dass Harnmingcode {
public static void main(String args{]) (
Scanner scan = new Scanner{System.in);
System.out.printin("Enter the number of bits for the Hamming data "y
int n= scan.nextint();
int al] = new intin];
for(int i=0 ji 0
if(Math.pow(2, power)
system.out.print(ali-
}
system.out.printin();seseeeeeeeee HOH OUTPUTH HH sactceceeess
ricrosoft Windows [Version 6.3.9600]
013 Microsoft Corporation. All rights reserved
a2
cusers\SSICOEI> ca,
crpedteb
cAteboset pat! rogram Files\Java\jdk1.8.0_192\bin
C.\teb>javac HammingCode.java
c:\teb>java HammingCode
Enter the number of bits for the Hammi;
7
Enter bit no. 7:
1
Enter bit
Enter bit no. 5:
1
Enter bit no. 4:
°
Enter bit no. 3:
1enter bit nO: 2
o
enterbit no. 2:
1
you entered:
3010101
Generated code is:
40100101111.
Enter position of a bit to alti
‘0 check for error detecti
jon at the receiver en
4 (0 for no error):
5
sent code is:
so100111111
Error is at location 5.
Corrected code is: