“Konvertieren Sie INT in Java in Array” Code-Antworten

Java int zu int Array

int number = 110101; 
String temp = Integer.toString(number);
int[] numbers = new int[temp.length()];
for (int i = 0; i < temp.length(); i++) {
    numbers[i] = temp.charAt(i) - '0';
}
earthstorm16

Ändern Sie die Nummer in Java in Array

String temp = Integer.toString(guess);
int[] newGuess = new int[temp.length()];
for (int i = 0; i < temp.length(); i++)
{
    newGuess[i] = temp.charAt(i) - '0';
}
CollinsCode

Konvertieren Sie INT in Java in Array

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

Konvertieren Sie INT in Java in Array

{1,1,0,1,0,1]

            		

Java answers related to “convert int to array in java”


Java queries related to “convert int to array in java”




Browse Java Answers by Framework


More “Kinda” Related Java Answers View All Java Answers »

Curious Cow

Ähnliche Antworten wie “Konvertieren Sie INT in Java in Array”

Fragen ähnlich wie “Konvertieren Sie INT in Java in Array”

Weitere verwandte Antworten zu “Konvertieren Sie INT in Java in Array” auf Java

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen