how to round up string if necessary if not just leave it like that
<p>My requirement goes like this</p>

<ul>
<li>if it is 1.0 output is 1</li>
<li>if it is 1.00 output is 1</li>
<li>if it is 1.5 output is 1.5</li>
<li>if it is 1.25 output is 1.25</li>
<li>sometimes it may be empty</li>
</ul>

<p>I tried like this:</p>

<pre><code>public class roundup 
{
    public static String Convert_Roundup(Float Amount, String element)  
    {
        if (Amount &gt; 0)
        {
            LEFT(Amount,INDEX(Amount,element)    
        }
        else 
            return Amount;
        }       
    }
}
</code></pre>

<p>As i am beginner user of Java and Talend I got to write a routine so that i can reuse it anytime.</p>

<p>My old routine which rounds any float value to two decimals:</p>

<pre><code>public class decimal 
{
    public static String ConvertTo_TwoDecimals(Float Amount) 
    {
        String Amount1 = "";
        if (Amount != null) 
        {
            DecimalFormat myFormat = new DecimalFormat("0.00");
            Amount1 = myFormat.format(Amount);
        }
        return Amount1;
    }
}
</code></pre>
