code to Display number exists in String variable,In float format with .00 format

 String ss="120459"+".00";
        double num = Double.parseDouble(ss);//convert String to Double       
        double newNum = Math.round(num*100.0)/100.0;
        ss=Double.toString(newNum);//convert Double to String
        System.out.println ("----------sss-----"+ss); //prints 1001.27
        System.out.println ("------newNum----"+newNum);
        System.out.println ("------floatValue----"+Float.parseFloat(ss));


Popular posts from this blog

Custom Dialog with no title and full screen in Android

code to display .pdf,.text,.DOC,.DOCX,.doc extension files exists in SDCard

Best working code to set Date limits on Date Picker Dialog,in Android