Java - Write code to convert String To Int via Double.valueOf()

Requirements

Write code to convert String To Int via Double.valueOf()

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        String sMt = "12312";
        System.out.println(convertStringToInt(sMt));
    }/*from  w  ww .ja v a 2 s  .  c om*/

    public synchronized static int convertStringToInt(String sMt) {
        int result = 0;
        try {
            if (sMt != null) {
                result = Double.valueOf(sMt).intValue();
            }

        } catch (Exception e) {

        }
        return result;
    }
}