Spiral Java solution