Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - JAVA programming: programming realizes the descending sort of the array INTA [] = {78 23 56 3412 45 67 89 901}.
JAVA programming: programming realizes the descending sort of the array INTA [] = {78 23 56 3412 45 67 89 901}.
Numbers have a method.

arrays . sort(a);

int arry[]={2, 1,4,3,7,9,6 };

arrays . sort(arry);

For (integer a: arry) {

system . out . println(a);

}

For example:

Import java.util.arrays;

Public course examination

{

Public static void main(String[] args)

{

int a[] = new int[]{8,5,4,2,0,9 };

arrays . sort(a);

System.out.println ("the result of sorting is du:");

for(int I = 0; I<a. Length; i++)

{

system . out . print(a[I]+" ");

}

Extended data:

When editing and running a Java program, these four aspects should be involved simultaneously. Use word editing software (such as Notepad, WordPad, UltraEdit, etc.). ) or integrated development environment (Eclipse, MyEclipse, etc. Define different classes in the Java source file, access the resource system by calling the methods in the class (these classes realize Java API), compile the source file into binary intermediate code and store it in the class file. Then run the class file by running the Java virtual machine corresponding to the operating system platform environment, execute the bytecode generated by compilation, and call the methods implemented in the class file to meet the Java API call of the program.

Baidu encyclopedia -Java