public class CheckIntArrayExample2
{
	public static final int VALID       = 0;
	public static final int NO_MATCH    = 1;
	public static final int MULTI_MATCH = 2;
	
	public int checkIntArrays(int[] inputArray)
	{
		int aryIndex;
		int matchCount = 0;
		int arySize = inputArray.length;
		for(aryIndex = 0; aryIndex < arySize; aryIndex++)
		{
			if(inputArray[aryIndex] > 20)
			{
				matchCount++;
			}  
		}
		if(matchCount == 1)
		{
			return(VALID);
		}
		if(matchCount == 0)
		{
			return(NO_MATCH);
		}
		return(MULTI_MATCH);
	}
	
	public void testArray(int array[])
	{
		// Print the array then test it.
		System.out.print("Check array {");
		boolean firstTime = true;
		for (int i=0; i<array.length; i++)
		{
			if (!firstTime)
				System.out.print(",");
			else
				firstTime = false;
			System.out.print(" " + array[i]);
		}
		System.out.print(" }:");
		int retVal = checkIntArrays(array);
		switch (retVal)
		{
			case VALID:
				System.out.println("VALID");
				break;
			case NO_MATCH:
				System.out.println("NO_MATCH");
				break;
			case MULTI_MATCH:
				System.out.println("MULTI_MATCH");
				break;
			default:
				System.out.println("Unknown value: " + retVal);
		}
	}
	
	public static void main(String args[])
	{
		int arrayB[] = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 };
		int arrayC[] = { 5, 10, 15, 20, 25 };
		int arrayD[] = { 20, 40, 60, 80, 100 };
		CheckIntArrayExample2 ex = new CheckIntArrayExample2();
		ex.testArray(arrayB); // Question b
		ex.testArray(arrayC); // Question c
		ex.testArray(arrayD); // Question d
	}
}
