java - Why am I getting array elements with "0"? (See pastie inside) -


Hey there's Java initials here :) Well, I'm having some trouble with this program:

< P> 1) I want to divide my program into an odd list of "input" arrays, even set up lists and negative lists. However, while dividing it, it is adding a bunch of elements in the form of "0".

2) 0 will only be added to the weird list.

3) How do I add from the average and griter to the end of the array?

thanks :)

1) Your array is longer than its content Because, because an array is of fixed length, there should be some extra spots which are 0.

2) You should add 0 if possible, even in the list, because << >> <<<> = <0> <0>

int [] oddList = new int [a.length + 1]; Use the array line line.length-1] = averageAndGreater (input2);

The easiest way to get an array of the right size is to use the built-in Arriylist class in Java. You can also remake at the end of the method, when you know how long it should be. Like the following:

  int array = new int [total]; For (int i = 0; i  (( A [i]% 2 == 0) & a [i]> = 0)  as you also have exams. 


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -