Java tutorial
//package com.java2s; import javax.swing.SwingConstants; public class Main { public static void validateDirection(int direction) { if (direction != SwingConstants.NORTH && direction != SwingConstants.EAST && direction != SwingConstants.SOUTH && direction != SwingConstants.WEST) { throw new IllegalArgumentException("invalid direction"); } } }