My application deals with prices, I am facing a small problem here. I will explain it clearly in steps.

Following are my inputs and OutPut should be.


  input  1.01  =  output 1 
  
  input 1.748  = output 1.75
  
  input 1.98  =output 2
  
  input 1.49 = output 1.5
  
  input 20.0 = output 2


0

I have used the following code but I can't achieve it

    double calc = 1.98;
            DecimalFormat df = new DecimalFormat("#.##");  
            calc = Double.valueOf(df.format(calc));
            System.out.println(String.valueOf(calc).replaceAll("([0-9])\\.0+([^0-9]|$)", "$1$2"));

::&gt; output is 1.98 which should be 2

double calc = 20.0;
        DecimalFormat df = new DecimalFormat("#.#");  
        calc = Double.valueOf(df.format(calc));
        System.out.println(String.valueOf(calc).replaceAll("([0-9])\\.0+([^0-9]|$)", "$1$2"));

 ::&gt; output is 20 this is correct for me.

double calc = 2.01;
        DecimalFormat df = new DecimalFormat("#.##");  
        calc = Double.valueOf(df.format(calc));
        System.out.println(String.valueOf(calc).replaceAll("([0-9])\\.0+([^0-9]|$)", "$1$2"));

::&gt; output is 2.01  Which should be 2.


following code which I have tried.


Question: Ensuring successful merges in Subversion
Answer: Branching always begins with fear that merging will break things or leave unnoticed bugs for long. 

However, it is the most essential element for a reasonably sized product or project. Here are the few distinct categories where branches are a must - 
they are :  

1. Branch post release
This is done to maintain post release patches. these patches are essential to support current versions in the market till next major releases are still not ready. 

2. Branch per Task or component 
Here a few independent groups are given the branch that they keep check-in while rest of the team (or other branches) doesn't have to accept any work till entire new functionality or project is completely finished and merged to trunk.

3. Branching for special customer support
Here a few branches are created to support only for a specific (set) of customers. 

Branching and merging begins with some fear always, but in my experience, as people begin to put disciplined code, it becomes indispensable for any large development.

See URLS below for more details.

http://www.codinghorror.com/blog/2007/10/software-branching-and-parallel-universes.html

http://stackoverflow.com/questions/631900/branching-hell-where-is-the-risk-vs-productivity-tipping-point