public class Example2 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
//DECLARE ARRAYS
int[] intArray = new int[10];
char[] charArray = new char[10];
//call method
//this works to call the method of numbers below
intArray = Numbers(intArray);
//call method to convert string of numbers to character Array
charArray = Convert(intArray, charArray);
//print charArray to screen
for(int i = 0; i < 10; i++)
{
System.out.print(charArray[i] + " ");
}
}
public static int[] Numbers(int[] numbers)
{
System.out.print("These are the ints: ");
for (int i = 0; i < 10; i++)
{
numbers[i] = i; //Store number in an integer array
System.out.print(numbers[i] + " "); //Print each number to screen
}
System.out.println("");
return numbers;
}
//Returns an array of numbers as characters
//@PARAM The array to be converted
//and The array to store the conversions
public static char[] Convert(int[] numbers, char[] converted)
{
System.out.print("These are the chars: ");
for(int i = 0; i < converted.length; i++)
{
converted[i] = Character.forDigit(numbers[i], 10);
}
return converted;
}
}