0

//turns a string of integers into an int[] array // reversed is the name of the string of integers

Here is the code:

    public int[] makeintArray(){
          intArray = new int[reversed.length()];
          for (int i = 0; i < reversed.length(); i++){
              intArray[i] = reversed.charAt(i) - 48;
              System.out.println("int " + i + " is " + intArray[i]);
  }
  System.out.println("IntArray is: " + intArray);
  return intArray;

}

//Whenever I run this I get the integer array returned as "cf814a82@I[" rather than [3, 3, 8, 2, 3, 8, 2, 8]

0 Answers0