Here you can find the source of alterationValueToString(double value)
Parameter | Description |
---|---|
value | double |
public static String alterationValueToString(double value)
//package com.java2s; /*/*from ww w . j ava 2s .co m*/ * This file is part of cBioPortal. * * cBioPortal is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ import java.util.Formatter; public class Main { /** * Format percentage. * * <p/> * if value == 0 return "--" * case value * 0: return "--" * 0<value<=0.01: return "<1%" * 1<value: return "<value>%" * * @param value double * * @return String */ public static String alterationValueToString(double value) { // in oncoPrint show 0 percent as 0%, not -- if (0.0 < value && value <= 0.01) { return "<1%"; } // if( 1.0 < value ){ Formatter f = new Formatter(); f.format("%.0f", value * 100.0); return f.out().toString() + "%"; } }