Originally Posted by

**wolveine903**
Got this problem I have been struggling on for hours that is extra credit for my class:

Write a recursive method that returns the currency format of the given integer value (val ). All inter-mediate operations must be carried out as integer arithmetic. The only time you are allowed to use string operations is to return the result. You may use the String.valueOf() or Long.toString() methods. Recall that 27341 % 1000 is 341 and 27341 / 1000 is 24.

public String formatAsCurrency(long val) { }

For this question, make sure your method works correctly for numbers that are multiple of 1000 or has consecutive zeros. Examples:

formatAsCurrency(5000481L) returns "5,000,481"

formatAsCurrency(434L) returns "434"

formatAsCurrency(76L) returns "76"