java 使用eval.jar解析公式
eval.jar 需要到https://eval.dev.java.net/
下载
--下面是示例使用,支持中文变量
Expression exp = new
Expression("(x + y)/2"
);
Map<String, BigDecimal> variables = new
HashMap<String, BigDecimal>();
variables.put("x", new
BigDecimal("4.32"
));
variables.put("y", new
BigDecimal("342.1"
));
BigDecimal result = exp.eval(variables);
System.out
.println(result);
相关文档:
package com.xiaobian;
public class BubbleSort {
//冒泡排序
public static void bubbleSort(int[] data){
&n ......
贴段代码,有少许注释:
package ibees;
import java.util.Arrays;
public class BinarySearch {
/**
* @param args
*/
public static void main(String[] args) {
double[] src = new double[]{1.3,9.9,10.89,12.89,89.0};
System.out.println(new BinarySearch().binarySearch(src, 89.0));
}
......
1.修改项目的.project文件,保存,刷新工程。
在<natures>
…
</natures>
之间添加下列三行配置
<nature>org.eclipse.wst.common.project.facet.core.nature</n ......
public class Test {
public static void main(String args[]) {
System.out.println(Integer.toBinaryString(20)); //十进制-->2进制
System ......
java中字符串转换成时间格式总结
关键字: java 字符串 时间 格式
通过长时间的对时间不同格式的转换,自己觉得其实就是对毫秒数的操作
Java代码
System.currentTimeMillis()
System.currentTimeMillis()
得到从1970年1月1日到现在的毫秒数,就可以转换成各种的形式。
有这样一个字符串:“ ......