Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java ordenar los valores de un array de menor a mayor

int a[] = {5,3,2,7,10,1};
    for (int x = 0; x < a.length; x++) {
        for (int i = 0; i < a.length-x-1; i++) {
            if(a[i] < a[i+1]){
                int tmp = a[i+1];
                a[i+1] = a[i];
                a[i] = tmp;
            }
        }
    }
Source by es.stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #java #ordenar #los #valores #de #array #de #menor #mayor
ADD COMMENT
Topic
Name
1+3 =