public long howMany(int size, int[] start, int[] end, int numMoves) {
    long steps[][][] = new long[size][size][numMoves + 1];
    steps[start[0]][start[1]][0] = 1;
    for (int n = 1; n <= numMoves; n++) {
      for (int i = 0; i < size; i++) {
        for (int j = 0; j < size; j++) {
          if (steps[i][j][n - 1] > 0) {
            for (int m = 0; m < mx.length; m++) {
              int nx = i + mx[m];
              int ny = j + my[m];
              if (nx < 0 || ny < 0 || nx >= size || ny >= size) continue;
              steps[nx][ny][n] += steps[i][j][n - 1];
            }
          }
        }
      }
    }
    int a = 3;
    return steps[end[0]][end[1]][numMoves];
  }