Here you can find the source of safeToBigDecimal(Object obj1)
Parameter | Description |
---|---|
obj1 | Object |
public static BigDecimal safeToBigDecimal(Object obj1)
//package com.java2s; /*/*from w w w .j a va 2 s . c om*/ * Copyright (C) 2010 Viettel Telecom. All rights reserved. * VIETTEL PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ import java.math.BigDecimal; public class Main { /** * @param obj1 Object * @return BigDecimal */ public static BigDecimal safeToBigDecimal(Object obj1) { BigDecimal result = BigDecimal.ZERO; if (obj1 == null) { return result; } try { result = new BigDecimal(obj1.toString()); } catch (Exception ex) { } return result; } }