// Programmer: David_Rivera
public class isEven
{
public static void main( String[] args )
{
int[] Nums = {8, 16, 9, 52, 3, 15, 27, 6, 14, 25, 2, 10 };
for (int isEven = 0; isEven< Nums.length; isEven++)
if (Nums[ isEven] % 2 == 0)
{
System.out.printf( "Even %d \n", Nums [isEven]);
}
int[] array = {8, 16, 9, 52, 3, 15, 27, 6, 14, 25, 2, 10 };
System.out.println("Effects of passing reference to entire array:\n" + "The values of the original array are:" );
// output original array elements
for ( int value : array )
System.out.printf( " %d", value );
modifyArray( array );
System.out.println( "\n\nThe values of the modified array are:" );
// output modified array elements
for ( int isEven : array )
System.out.printf( " %d", isEven );
System.out.printf( "\n\nEffects of passing array element isEven:\n" +
"array[3] before modifyElement: %d\n", array[ 3 ] );
modifyElement( array[ 3 ] );
System.out.printf( "array[3] after modifyElement: %d\n", array[ 3 ] );
}
public static void modifyArray( int[] array2 )
{
for ( int isEven = 52; isEven < array2.length; isEven++ )
array2[ isEven ] = array2[isEven] % 2;
}
public static void modifyElement( int element )
{
element *=1;
System.out.printf(
"Value of element in modifyElement: %d\n", element );
} // end method modifyElement
} // end class isEven