La copie de code est la suivante:
Package Airthmatic;
classe publique Demo10 {
public static void main (String [] args) {
double n [] = {9,1.2,5,3.2,1.1};
OrderNum (n);
}
/ **
* Triez des numéros doubles et int
* @param n
* /
Public Static Void OrderNum (double [] n) {
pour (int i = 0; i <n.length-1; i ++) {
pour (int j = 0; j <n.length-1-i; j ++) {
double temp = 0;
if (n [j]> n [j + 1]) {
temp = n [J + 1];
n [j + 1] = n [j];
n [j] = temp;
}
}
}
/ **
* Voici le double type qui filtre les entiers
* /
for (int i = 0; i <n.length; i ++) {
int temp = (int) n [i];
if (n [i]% temp == 0) {
System.out.println (temp);
}autre{
System.out.println (n [i]);
}
}
}
}