所以我是comp sci的第一年学生,我必须创建一个程序,让一个数组加扰它,然后再对它进行排序.我几乎让它工作,但由于某种原因,我的一个while循环将无法工作,并完全被绕过.我真的很陌生,所以所有的帮助都表示赞赏.我排序,打印工作,争抢只是给我一些麻烦.
import java.io.*;
import java.util.Random;
public class Driver03
{
public static void main(String[] args)
{
int[] array = {100, 101, 102, 103, 104, 105, 106, 107, 108, 109};
print(array);
array = scramble(array);
print(array);
array = sort(array);
print(array);
}
public static void print(int[] apple)
{
for(int x = 0; x < apple.length; x++){
System.out.println(apple[x]+"");
}
}
public static int max;
public static int maxIndex;
public static int temp;
public static int[] sort(int[] grape)
{
for(int y = grape.length; y > …
Run Code Online (Sandbox Code Playgroud)