Skip to main content

problem with my array function

Please note these forums are being decommissioned and use the new and improved forums at
1 reply [Last post]
Joined: 2014-05-30
Points: 0

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)

if (isodd[i]>max) {
return 1;
return 0;


Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2014-06-13
Points: 0

Array Formula Rules -
1) Each argument within an array must have the same amount of rows and columns.
2)You must enter an array by pushing Ctrl+Shift+Enter.
3) You cannot add the {} (braces) that surround an array yourself, pushing Ctrl+Shift+Enter will do this for you.
4)You cannot use an array formula on an entire column.