All pastes #513921 Raw Edit

Mine

public text v1 · immutable
#513921 ·published 2007-05-27 13:56 UTC
rendered paste body
//Working the percent up to two digit
 public String getChartPieValue()
    {
        try
        {
            Iterator iter = serverCollection.iterator();
            chartValue = "";
            while(iter.hasNext())
            {

                server = (Server)iter.next();
                Float val = new Float(server.getPiepercent());
                chartValue = chartValue  + val.toString().substring(0,val.toString().indexOf(".") + 3) + "% (" +  server.getName() +  ")|";
            }
            return  chartValue.substring(0, chartValue.length()-1);
        }

        catch(StringIndexOutOfBoundsException e)
        {
            System.out.print("Error: Method <getChartValue()>: Error in getting value. May be file not valid.");
        }
        catch(Exception e)
        {
            System.out.print("Error: " + e.toString());
        }
        return "";
    }

============================================================================================================================================================================
// not working upto two decimal
public String getChartPieValue()
    {
        try
        {
            Iterator iter = serverCollection.iterator();
            chartValue = "";
            while(iter.hasNext())
            {

                server = (Server)iter.next();
                chartValue = chartValue  + server.getPiepercent() + "% (" +  server.getName() +  ")|";
            }
            return  chartValue.substring(0, chartValue.length()-1);
        }

        catch(StringIndexOutOfBoundsException e)
        {
            System.out.print("Error: Method <getChartValue()>: Error in getting value. May be file not valid.");
        }
        catch(Exception e)
        {
            System.out.print("Error: " + e.toString());
        }
        return "";
    }