Hello, I want to write an array method that is called ReallyOdd (int[] x) . The method will read the parameter as shown below, the function looks for the maximum odd numbers in the function if one or two maximum numbers are greater than the all the even numbers then the function return 1 else it returns 0
For example we have ReallyOdd (new int[]{2,5,19,13,6}); in which 19,13 are greater than all even numbers. This must return 1 else 0
Class Theodd { public static void main(String [] args) { //function parameter, no i/o input required reallyOdd(new int[]{10}); reallyOdd (new int[]{2,5,19,13,6}); reallyOdd (new int[]{1, 4,1,1,1,1}); } static int reallyOdd (int[] x) { int iseven = 0; int isodd = 0; int max=[0]; for (int i=0; i< x.length; i++) { if (x[i]%2 == 0) iseven[i]=x[i]; else isodd[i]=x[i]; } if (isodd[i]>max) { max=isodd[i]; if(max>iseven[i]){ return 1; else return 0; } } } }