I want to calculate all possbie hamming neighbours from a given byte with a maximum hamming distance.
For a hamming distance of 1 I have created this function:
public static ArrayList<Byte> hammingNeighbours(byte input, int maxDistance){
ArrayList<Byte> neighbours = new ArrayList<>();
neighbours.add(input);
byte value;;
byte mask = 1;
for (int i = 0; i < 8; i++) {
value = (byte) (input ^mask);
neighbours.add(value);
mask = (byte) (mask << 1);
}
return neighbours;
}
But how to add neighbours with a distance > 1? can someone help me to solve this problem?
best regards