I have a class in my Application where int values are stored:
Characters.class:
public int charPunch(int q) {
int[] charPunch = {
15,
10,
20,
25,
20,
20,
15,
20,
20,
25
};
return charPunch(q);
}
The q value is decided by user character selection. I'm trying to understand the code and so just posted the code as it currently is.
In the same class file I have an array of Strings which I can then convert (in another .class file) with .toString();
Game.class:
oneName = Ch.charName(q).toString();
This gives playerOne's oneName the array value and converts the String array result to a single String and works!
My question is: Am I able to do the exact same thing to an array of int values?
Would changing the int array to a String array, converting the String array to a single String and then the String to an int be terrible programming but my best solution?
String onePunch = charPunch(q).toString(); int charPunchInt = Integer.parseInt(charPunch);
I currently get StackOverflowError on the Characters.class array's return line until the process gives up.