Here is my code:
private static String recString(final int i) {
return (i>0 ? i + "." + recString(i-1) : i<0? "." + recString(i+1) : "" ) ;
}
The method should return i dots and the number of dots at begin (example recString(4) returns "4....") when i>0 and just dots when i<=0 (example recString(-4) returns "...."). The condition is that I use just one return line any other modification is not allowed. All I get "4.3.2.1." when I call recString(4). I see where is the problem but cant figure out how to take variable just at the beginning and not change it ? Thanks in advance