Java 정렬

1 개요[ | ]

Java 정렬

2 int 배열[ | ]

import java.util.Arrays;

public class MyClass {
    public static void main(String[] args)
    {
        int[] arr = { 11, 1, 12, 2 };
        Arrays.sort(arr);
        System.out.println( Arrays.toString(arr) );
    }
}
import java.util.Arrays;
import java.util.Collections;

public class MyClass {
    public static void main(String[] args)
    {
        Integer[] arr = { 11, 1, 12, 2 };
        Arrays.sort(arr, Collections.reverseOrder());
        System.out.println( Arrays.toString(arr) );
    }
}

3 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}