Java - Write code to convert String To Double

Requirements

Write code to convert String To Double

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        String sMt = "123123.123";
        System.out.println(convertStringToDouble(sMt));
    }/*from w w w.  j  av a  2s.  co  m*/

    public synchronized static double convertStringToDouble(String sMt) {
        double result = 0;
        try {
            result = Double.valueOf(sMt).doubleValue();
        } catch (Exception e) {

        }
        return result;
    }
}