24 lines
833 B
Java
24 lines
833 B
Java
|
public class Main{
|
||
|
public static void main(String[] args){
|
||
|
int[] tableauEntier = new int[args.length];
|
||
|
int i;
|
||
|
try{
|
||
|
for (i=0; i<args.length; i++){
|
||
|
tableauEntier[i] = Integer.parseInt(args[i]);
|
||
|
if (tableauEntier[i] < 0){
|
||
|
throw new NumberFormatException("Erreur : l'entier naturel saisis est negatif "+tableauEntier[i]);
|
||
|
}
|
||
|
}
|
||
|
Arbre arbre = new Arbre(tableauEntier);
|
||
|
|
||
|
int[] tableauArbre = arbre.toArray();
|
||
|
for (i=0; i<tableauArbre.length; i++){
|
||
|
System.out.print(tableauArbre[i] + " ");
|
||
|
}
|
||
|
System.out.println();
|
||
|
}
|
||
|
catch(NumberFormatException e){
|
||
|
System.out.println("argument invalide");
|
||
|
}
|
||
|
}
|
||
|
}
|