annotate src/main/java/de/intevation/lada/util/data/MathUtil.java @ 944:af0883b73551

Fix typo.
author Tom Gottfried <tom@intevation.de>
date Wed, 18 May 2016 14:12:41 +0200
parents
children
rev   line source
944
af0883b73551 Fix typo.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
af0883b73551 Fix typo.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
af0883b73551 Fix typo.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
3 *
af0883b73551 Fix typo.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
af0883b73551 Fix typo.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
af0883b73551 Fix typo.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
af0883b73551 Fix typo.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
7 */
af0883b73551 Fix typo.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
8 package de.intevation.lada.util.data;
af0883b73551 Fix typo.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
9
af0883b73551 Fix typo.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
10 import java.math.BigDecimal;
af0883b73551 Fix typo.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
11 import java.math.MathContext;
af0883b73551 Fix typo.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
12 import java.math.RoundingMode;
af0883b73551 Fix typo.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
13
af0883b73551 Fix typo.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
14 /**
af0883b73551 Fix typo.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
15 * Utilities for calculations
af0883b73551 Fix typo.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
16 *
af0883b73551 Fix typo.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
17 */
af0883b73551 Fix typo.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
18 public class MathUtil {
af0883b73551 Fix typo.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
19
af0883b73551 Fix typo.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
20 public static final MathContext ROUNDING_CONTEXT = new MathContext(3,
af0883b73551 Fix typo.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
21 RoundingMode.HALF_EVEN);
af0883b73551 Fix typo.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
22
af0883b73551 Fix typo.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
23 public static Double roundDoubleToThree(Double value) {
af0883b73551 Fix typo.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
24 if (value == null) {
af0883b73551 Fix typo.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
25 return null;
af0883b73551 Fix typo.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
26 }
af0883b73551 Fix typo.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
27 return BigDecimal.valueOf(value).round(ROUNDING_CONTEXT).doubleValue();
af0883b73551 Fix typo.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
28 }
af0883b73551 Fix typo.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
29
af0883b73551 Fix typo.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
30 }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)