public double getBottomBorder() { double result = ships.get(0).y + ships.get(0).height; for (EnemyShip ship : ships) { double height = ship.y + ship.height; if (height > result) { result = height; } else {return ship.y;} } return result; } Я попробовал блок try catch что не помогает не чего