Quantcast
Channel: ArrayList Sorting - Stack Overflow
Browsing all 4 articles
Browse latest View live

Answer by csd for ArrayList Sorting

If you do not use the int odd[] and int even[] arrays elsewhere in your code, than you can get rid of those mystical zeros by omitting the arrays totally. You will get shorter - witch is always nice -...

View Article



Answer by pr0gramista for ArrayList Sorting

When you create a array like this: int odd[] = new int[25]; what you gets it's a array of zeros, 25 of them. That's because int cannot be null.So when you sort all the zeros at the end of your array...

View Article

Answer by user7605325 for ArrayList Sorting

The 2 loops for (int i = 0; i < even.length; i++): instead of using even.length you should use numEven and numOdd, as you want to add just the quantity of even and odd numbers you've found. This...

View Article

ArrayList Sorting

I need to sort even and odds using array listimport java.util.ArrayList;import java.util.Collections;import java.util.Random;public class SortedEvensAndOdds {public static void main(String[] args) {...

View Article
Browsing all 4 articles
Browse latest View live




Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>