hi, i was wondering if anyone could help me out? i have this project in my java class where i need to format an integer to a string with commas (ex:1000000->1,000,000) using recursion. I've tried it for 4 class periods and i just can't figure it out. If you feel guilty by giving me just the answer feel free to give me a tutorial on recursion so that i get the answer and understand it better.
I figured some people woudl like to see what i have now.
static String insertCommas(int num)
{
int rem=0;
String str="";
if(num<1000)
{
str+=num;
return str;
}
else
{
str+=num+",";
insertCommas(num%1000);
}
return str;
}