I need to return the middle 2 characters of a word, favoring the right.
so for example:
so far i have:
I can't figure out how to favor the right.
so for example:
Code:
SevenMethods myFuns = new SevenMethods();
assertEquals("34", myFuns.middleTwo("12345"));
Code:
public String middleTwo(String arg) {
int middle = arg.length() / 2;
int middle2 = middle / 2;
String middleTwo = "" + arg.charAt(middle2) + "" + arg.charAt(middle);
return middleTwo;
I can't figure out how to favor the right.
Comment