getIndexByZone static method

int getIndexByZone(
  1. int zone,
  2. int indexOfZone
)

Implementation

static int getIndexByZone(int zone, int indexOfZone) {
  int x = zone ~/ 3 * 3 + indexOfZone ~/ 3;
  int y = zone % 3 * 3 + indexOfZone % 3;
  return x * 9 + y;
}