import java.util.Arrays;
public class Main {
public static void main(String[] args) {
int numbers[] = { 3, 1, 8, 34, 1, 2, 13, 89, 5, 21, 55 };
System.out.print("Before: ");
for (int i = 0; i < numbers.length; i++) {
int number = numbers[i];
System.out.print(number + "; ");
}
Arrays.sort(numbers);
System.out.print("After: ");
for (int i = 0; i < numbers.length; i++) {
int number = numbers[i];
System.out.print(number + "; ");
}
float money[] = { 1.05f, 99.8f, 3f, 4.55f, 7.23f, 6.50f };
Arrays.sort(money, 3, money.length);
for (int i = 0; i < money.length; i++) {
float v = money[i];
System.out.print(v + "; ");
}
}
}
|