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

📄 numberutil.java

📁 cwbbs 云网论坛源码
💻 JAVA
字号:
package cn.js.fan.util;import java.text.DecimalFormat;public class NumberUtil {  public NumberUtil() {  }    public static String round(double v,int scale) {                String temp = "##0.";    for (int i = 0; i < scale; i++) {      temp += "0";    }    DecimalFormat d = new DecimalFormat(temp);    return d.format(v);  }    public static String roundRMB(double v) {    String temp = "##0.00";    DecimalFormat d = new DecimalFormat(temp);    return d.format(v);  }    public static String roundRMB2Feng(double v) {        String temp = "##0.";    DecimalFormat d = new DecimalFormat(temp);    d.setDecimalSeparatorAlwaysShown(false);    return d.format(v*100);  }    public static int random(int a, int b) {      return (int)((b-a)*Math.random() + a);  }  public static long random(long a, long b) {      return (long)((b-a)*Math.random() + a);  }}

⌨️ 快捷键说明

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