public class DroidMovement
{
    public static final int NORTH = 1;
    public static final int SOUTH = 2;
    public static final int WEST = 3;
    public static final int EAST = 4;

    public static final int backupDirection (int direction)
    {
        switch (direction)
        {
            case NORTH:
                return SOUTH;
            case SOUTH:
                return NORTH;
            case WEST:
                return EAST;
            case EAST:
                return WEST;
            default:
            {
                System.out.println("Error - invalid direction: "+direction);

                return 0;
            }
        }
    }

    public static final Coordinate[] getNextPositions (Coordinate coord)
    {
        Coordinate[] coords = new Coordinate[4];

        // N, E, S, W

        coords[0] = new Coordinate(coord.getX(), coord.getY() -1);
        coords[1] = new Coordinate(coord.getX() -1, coord.getY());
        coords[2] = new Coordinate(coord.getX(), coord.getY() +1);
        coords[3] = new Coordinate(coord.getX() +1, coord.getY());

        return coords;
    }

    public static final String toString (int direction)
    {
        switch (direction)
        {
            case NORTH:
                return "NORTH";
            case SOUTH:
                return "SOUTH";
            case WEST:
                return "WEST";
            case EAST:
                return "EAST";
            default:
                return "UNKNOWN";
        }
    }

    public static final String toString (String direction)
    {
        switch (direction)
        {
            case "1":
                return "NORTH";
            case "2":
                return "SOUTH";
            case "3":
                return "WEST";
            case "4":
                return "EAST";
            default:
                return "UNKNOWN";
        }
    }

    private DroidMovement ()  // prevent instantiation
    {
    }
}
@@ -833,16 +833,384 @@
 rds%5B0%5D =
+ getPosition(coord, NORTH);%0A        coords%5B1%5D = getPosition(coord, EAST);%0A        coords%5B2%5D = getPosition(coord, SOUTH);%0A        coords%5B3%5D = getPosition(coord, WEST);%0A%0A        return coords;%0A    %7D%0A%0A    public static final Coordinate getPosition (Coordinate coord, int direction)%0A    %7B%0A        switch (direction)%0A        %7B%0A            case NORTH:%0A                return
  new Coo
@@ -1257,27 +1257,53 @@
         
-coords%5B1%5D =
+    case EAST:%0A                return
  new Coo
@@ -1350,27 +1350,54 @@
         
-coords%5B2%5D =
+    case SOUTH:%0A                return
  new Coo
@@ -1444,27 +1444,53 @@
         
-coords%5B3%5D =
+    case WEST:%0A                return
  new Coo
@@ -1529,39 +1529,174 @@
 etY());%0A
-%0A        return coords;
+            default:%0A            %7B%0A                System.out.println(%22Unknown direction: %22+direction);%0A%0A                return coord;%0A            %7D%0A        %7D
 %0A    %7D%0A%0A

Update DroidMovement.java