So here's the deal that I was trying to create a program with Java Make a given int []
and another int []
which will be in ascending order ... here the code:
import java .util *. Public category encoding_ {public static zero main (string array []) {int [] DARRUR = 1, 34, 25, 67, 35, 68, 88}; Int [] Ore = new int [200]; Int [] countOf = new int [200]; For (Int i = 0; I> DARRE.Lamp; I ++) {Int Numeruff Loop = DARRA [i]; For (int j = 0; j & lt; dArray.length; j ++) {int diff = 0; If (J! = I) diff = NumForLoop - dArray [j]; If (diff & lt; 0) countOf [i] ++; } For (int k = 0; k & lt; dArray.length; k ++) {oArray [k] = DARRA [DARRA Length - count [of]]; } For (int i2 = 0; i2
and showing this error:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 7 on Accending_order.main (
So help .....
The problem is here When oArray [k] = DARRA [DARRA.] - Count [s]];
countOf [k] = 0
, you are trying to reach dArray [dArray.length]
and dArray. Length is
7, but the elements on your array are elements 0..6
Comments
Post a Comment