Java tutorial
//package com.java2s; /******************************************************************************* * Copyright (c) 2015 Eclipse RDF4J contributors, Aduna, and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Distribution License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/org/documents/edl-v10.php. *******************************************************************************/ import java.math.BigDecimal; public class Main { /** * Parses the supplied decimal/floating point string and returns its value. * * @param s * A string representation of an xsd:decimal or xsd:double value. * @return The decimal/floating point value represented by the supplied string argument. * @throws NumberFormatException * If the supplied string is not a valid xsd:decimal or xsd:double value. */ public static BigDecimal parseDecimal(String s) { // Note: BigDecimal can handle leading plus signs itself return new BigDecimal(s); } }