public static void grayToBinary(BinaryVariable variable){
  int n=variable.getNumberOfBits();
  BitSet gray=variable.getBitSet();
  variable.set(n - 1,gray.get(n - 1));
  for (int i=n - 2; i >= 0; i--) {
    variable.set(i,variable.get(i + 1) ^ gray.get(i));
  }
}

public static void grayToBinary ( BinaryVariable variable ) { int n = variable . getNumberOfBits ( ) ; BitSet gray = variable . getBitSet ( ) ; variable . set ( n - 1 , gray . get ( n - 1 ) ) ; for ( int i = n - 2 ; i >= 0 ; i -- ) { variable . set ( i , variable . get ( i + 1 ) ^ gray . get ( i ) ) ; } }
converts a binary variable from a gray encoding to binary encoding .
