private static int getValueAt(int[][] picture, int x, int y) {
    if (x < 0 || y < 0 || x > picture.length || y > picture[x].length) {
      return -1;
    } else {
      return picture[x][y];
    }
  }
Method created to avoid IndexOutOfBoundExceptions. This method return -1 if you try to access
an invalid position.
src/main/java/com/github/pedrovgs/problem42/FloodFill.java