Vector-to-direction method in Java I don't really have a problem, but my code bothers me, because I know it could be done in a much better way.

I have an enum of 4 directions: north west, north east, south east and south west. And I have a method that converts a vector to one of those directions. The method prefers North and East, so values of 0 would return those.

public enum Direction {
    NORTH_WEST, NORTH_EAST, SOUTH_EAST, SOUTH_WEST;

    public static Direction vectorToDirection(Vector2 vector) {
        if (vector.y &gt;= 0) {
            if (vector.x &gt;= 0) return NORTH_EAST;
            else return NORTH_WEST;
        } else {
            if (vector.x &gt;= 0) return SOUTH_EAST;
            else return SOUTH_WEST;
        }
    }
}


If anyone can figure out a cleaner or more efficient method, I'd love to know!
Use Braces:
Consider using braces for more readable code:

public static Direction vectorToDirection(Vector2 vector) {
    if (vector.y &gt;= 0) {
        if (vector.x &gt;= 0) return NORTH_EAST;
        else return NORTH_WEST;
    } else {
        if (vector.x &gt;= 0) return SOUTH_EAST;
        else return SOUTH_WEST;
    }
}


Becomes (with eclipse Ctrl + Shift + F):
public static Direction vectorToDirection (Vector2 vector) {
     if (vector.y &gt;= 0) {
         if (vector.x &gt;= 0) {
             return NORTH_EAST;
         } else {
             return NORTH_WEST;
         }
      } else {
         if (vector.x &gt;= 0) {
             return SOUTH_EAST;
         } else {
             return SOUTH_WEST;
         }
     }
}

And suddenly it becomes extremely obvious and readable what happens here.
Naming:
Additionally I'd consider naming your method fromVector() instead. Compare:
Direction.vectorToDirection(someVector);

against
Direction.fromVector(someVector);

Documentation:
When I see the implementation I know, but how would anyone outside know you prefer east &gt; west and north &gt; south? Write some JavaDoc. Example:
/**
* @param vector the 2-dimensional vector to be converted to a direction
* @returns The Direction. hereby North is preferred over South and 
* East is preferred over West. 
* Example: Direction.fromVector(new Vector2(0, 0)); will return NORTH_EAST
* Direction.fromVector(new Vector2(-1, 0)); will return SOUTH_EAST
*/
public static Direction fromVector(Vector2 vector) {
// ...