⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 boutils.java

📁 《基于Eclipse的开源框架技术与实战》[第5章]随书源码
💻 JAVA
字号:
package com.free.struts.storefront.businessobjects;/** * <p>Title: Eclipse Plugin Development</p> * <p>Description: Free download</p> * <p>Copyright: Copyright (c) 2006</p> * <p>Company: Free</p> * @author gan.shu.man * @version 1.0 */public class BOUtils {	public static Double getRoundedDouble(double unroundedValue) {		// Get the integer portion of the value		double intPortion = Math.floor(unroundedValue);		// Get the unrounded decimal portion		double unroundedDecimalPortion = (unroundedValue - intPortion);		/* ALERT - This next code interferes with I18N. We eventually need   */		/*         to change this not assume only round to 2 decimal places. */		/* Multiply the decimal places by 100, which shitfs the decimal point		/* two places to the left. Then round it so that we get a round to		/* two decimal places. For example, if we started with 17.655 and stripped		/* off the int portion, which left .655. After we shift, we are left with		/* 65.5. Then a round will gives us 66. We can then put it all back		/* together */		double roundedDecimalPortion =			Math.round(unroundedDecimalPortion * 100);		// Shift the decimal point back two places to the right		roundedDecimalPortion = roundedDecimalPortion / 100;		// Add the int portion and decimal portions back together		double total = intPortion + roundedDecimalPortion;		return new Double(total);	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -