Konversi int ke array di java
public class ArraySum {
public static void main(String[] args) {
int first = Integer.parseInt(args[0]);
int[] firstArray = transform(first);
int second = Integer.parseInt(args[1]);
int[] secondArray = transform(second);
int[] result = sum(firstArray, secondArray);
print(result);
}
public static int[] transform(int num){
// TODO change only the following part.
}
public static int[] sum(int[] a, int[] b){
// TODO change only the following part.
}
public static void print(int[] array){
System.out.print("[");
for (int i = 0; i < array.length; i++){
if(i != array.length - 1) {
System.out.print(array[i] + ", ");
}else{
System.out.print(array[i] + "]");
}
}
}
}
mohammad hajjo