Code review of code to strip 0 from decimal series The following code would strip 0 (all numbers ending with 0, it can contain 0, eg: 105 can be is valid but 150 should be eliminated) and return a number in decimal series if all numbers ending with 0 were stripped.
 Example : 0 -&gt; 1, 10 -&gt; 11, 19 -&gt; 22.
I would just appreciate any code reviews. 

  public static int getStrippedNumber(int num) {
    int setId = (num / 10) + 1;
    int newNum = num + setId;                             
    int newNumSetId = (newNum / 10) + 1;                   
    int numberToReturn = num + newNumSetId;
    return numberToReturn % 10 ==0 ? numberToReturn + 1 : numberToReturn;
    }
Well... Sorry to say this, but it's crappy!


The function name doesn't explain what the function does (and using your explanation above for Javadoc would only make things worse, judging from the confusion in the comments)
Even knowing the implementation doesn't help, it's hard to tell if the steps performed inside the function correspond to a real-world concept or represent some algorithm
it's not clear if this function makes sense for negative values, I'm pretty sure it would return unexpected values (i.e. output for x and -x would be drastically different). If the function is not defined for negative values, throw an IllegalArgumentException when num &lt; 0
You use confusing names for variables; I think even a, b, c etc. would be better than num, newNum, numberToReturn (nb. this last one is additionally misleading as you still process it before returning)
The function seems to solve some general problem but it uses arbitrary depth: repeats the same operation twice (in lines 1&amp;2 and 3&amp;4) instead of using a loop or recursion (which would also communicate your intentions better)


I know this is the part where you give your recommendations but I believe this function is broken beyond repair until you make it clear what its purpose and contract are. Remember that most real-world mathematical problems are already solved and have well-described algorithms, using well-tested solutions is always a better idea than trying to reinvent the wheel.