static public String decodeDirection(int d){
  if (d == NONE) {
    return "None";
  }
  StringBuffer b=new StringBuffer();
  if ((d & NORTH) != 0) {
    appendOne(b,"North");
  }
  if ((d & SOUTH) != 0) {
    appendOne(b,"South");
  }
  if ((d & EAST) != 0) {
    appendOne(b,"East");
  }
  if ((d & WEST) != 0) {
    appendOne(b,"West");
  }
  if ((d & CW) != 0) {
    appendOne(b,"CW");
  }
  if ((d & CCW) != 0) {
    appendOne(b,"CCW");
  }
  if ((d & LEFT) != 0) {
    appendOne(b,"Left");
  }
  if ((d & RIGHT) != 0) {
    appendOne(b,"Right");
  }
  if ((d & UP) != 0) {
    appendOne(b,"Up");
  }
  if ((d & DOWN) != 0) {
    appendOne(b,"Down");
  }
  final int mask=NORTH | SOUTH | EAST| WEST| CW| CCW| LEFT| RIGHT| UP| DOWN;
  if ((d & ~mask) != 0) {
    appendOne(b,"Unknown: 0x" + Integer.toHexString(d & ~mask));
  }
  return b.toString();
}

static public String decodeDirection ( int d ) { if ( d == NONE ) { return "None" ; } StringBuffer b = new StringBuffer ( ) ; if ( ( d & NORTH ) != 0 ) { appendOne ( b , "North" ) ; } if ( ( d & SOUTH ) != 0 ) { appendOne ( b , "South" ) ; } if ( ( d & EAST ) != 0 ) { appendOne ( b , "East" ) ; } if ( ( d & WEST ) != 0 ) { appendOne ( b , "West" ) ; } if ( ( d & CW ) != 0 ) { appendOne ( b , "CW" ) ; } if ( ( d & CCW ) != 0 ) { appendOne ( b , "CCW" ) ; } if ( ( d & LEFT ) != 0 ) { appendOne ( b , "Left" ) ; } if ( ( d & RIGHT ) != 0 ) { appendOne ( b , "Right" ) ; } if ( ( d & UP ) != 0 ) { appendOne ( b , "Up" ) ; } if ( ( d & DOWN ) != 0 ) { appendOne ( b , "Down" ) ; } final int mask = NORTH | SOUTH | EAST | WEST | CW | CCW | LEFT | RIGHT | UP | DOWN ; if ( ( d & ~ mask ) != 0 ) { appendOne ( b , "Unknown: 0x" + Integer . toHexString ( d & ~ mask ) ) ; } return b . toString ( ) ; }
decode the direction constants into a human - readable form . this should eventually be internationalized .
