public static void generateNextState(final char direction, final byte[] state) {
		final int p = Utility.posOfElement((byte) 0, state), dimension = (int) Math
				.sqrt(state.length);
		switch (direction) {
		case 'U':
			swap(p, p - dimension, state);
			break;
		case 'D':
			swap(p, p + dimension, state);
			break;
		case 'L':
			swap(p, p - 1, state);
			break;
		case 'R':
			swap(p, p + 1, state);
			break;
		default:
			break;
		}
	}