Skip to content

Instantly share code, notes, and snippets.

@gusthavosouza
Created September 2, 2013 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gusthavosouza/6413232 to your computer and use it in GitHub Desktop.
Save gusthavosouza/6413232 to your computer and use it in GitHub Desktop.
Imprimir numeros do array em ordem crescente. utilizando sort.
import java.util.Scanner;
import java.util.Arrays;
public class Crescente {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
Arrays crescente = null;
long[] arr = new long[4];
for (int i = 0; i < arr.length; i++) {
arr[i] = scan.nextLong();
}
for (int a = 0; a < arr.length; a++) {
crescente.sort(arr);
System.out.println(arr[a]);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment