Java examples for java.lang:double
Calculate Percentage.
/******************************************************************************* * <copyright> Copyright (c) 2014-2016 Bauhaus Luftfahrt e.V.. All rights reserved. This program and the accompanying * materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html </copyright> ******************************************************************************/ //package com.java2s; public class Main { /**/*from w w w . ja va2 s.c om*/ * Percentage. * * @param value * the value * @param maximumValue * the maximum value * @return the int */ public static int percentage(double value, double maximumValue) { return (int) ((value / maximumValue) * 100.0); } }