private static int manhattanDistance(final int x1,final int y1,final int x2,final int y2){
  return Math.abs(x1 - x2) + Math.abs(y1 - y2);
}

private static int manhattanDistance ( final int x1 , final int y1 , final int x2 , final int y2 ) { return Math . abs ( x1 - x2 ) + Math . abs ( y1 - y2 ) ; }
calculates the manhattan distance between to positions .
