??xml version="1.0" encoding="utf-8" standalone="yes"?>av亚洲精华国产精华精华,国产成人一二片,免费一级在线观看http://www.aygfsteel.com/jlin/category/53793.htmlzh-cnWed, 30 Jan 2019 04:07:44 GMTWed, 30 Jan 2019 04:07:44 GMT60- java.lang.ClassCastException 两个一LcM能强?/title>http://www.aygfsteel.com/jlin/archive/2019/01/30/433626.htmlflyflyWed, 30 Jan 2019 03:30:00 GMThttp://www.aygfsteel.com/jlin/archive/2019/01/30/433626.htmlhttp://www.aygfsteel.com/jlin/comments/433626.htmlhttp://www.aygfsteel.com/jlin/archive/2019/01/30/433626.html#Feedback0http://www.aygfsteel.com/jlin/comments/commentRss/433626.htmlhttp://www.aygfsteel.com/jlin/services/trackbacks/433626.htmlpȝ报错Q?java.lang.ClassCastException: com.entity.Job cannot be cast to com.entity.Job
spring boot 目引入?spring的devtools l常会生这个问?nbsp; Q当把这个引入取消就不会出现?/div> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>

]]> - Bean复制的几U框架性能比较QApache BeanUtils、PropertyUtils,Spring BeanUtils,Cglib BeanCopierQ??http://www.aygfsteel.com/jlin/archive/2017/07/25/432690.htmlflyflyTue, 25 Jul 2017 13:53:00 GMThttp://www.aygfsteel.com/jlin/archive/2017/07/25/432690.htmlhttp://www.aygfsteel.com/jlin/comments/432690.htmlhttp://www.aygfsteel.com/jlin/archive/2017/07/25/432690.html#Feedback0http://www.aygfsteel.com/jlin/comments/commentRss/432690.htmlhttp://www.aygfsteel.com/jlin/services/trackbacks/432690.html阅读全文

]]> - DecimalFormatҎ值格式化的舍入问题——RoundingMode--?/title>http://www.aygfsteel.com/jlin/archive/2017/02/28/432344.htmlflyflyTue, 28 Feb 2017 03:14:00 GMThttp://www.aygfsteel.com/jlin/archive/2017/02/28/432344.htmlhttp://www.aygfsteel.com/jlin/comments/432344.htmlhttp://www.aygfsteel.com/jlin/archive/2017/02/28/432344.html#Feedback0http://www.aygfsteel.com/jlin/comments/commentRss/432344.htmlhttp://www.aygfsteel.com/jlin/services/trackbacks/432344.html背景Q?/h4>
在对数值做一些计的时候,往往我们需要控制计结果的_ֺQ所以会使用到DecimalFormatcL数值格式化成字W串。在最q?a title="软g试知识? target="_blank" style="color: #df3434; text-decoration: none; font-weight: bold;">试中,H然注意到默认用DecimalFormatq行格式化时Qƈ非我们一般认识上的四舍五入,而是一U诡异的舍入——(1)5以下舍去(2)5以上舍入(3)若前一位是奇数Q?p?4)如前一位是偶数Q?p?/p>
遇到q样的统计结论,没有理论的支持,我们L感到很迷茫,所以我仔细查阅了DecimalFormat相关APIQ终于找C{案?/p>
分析Q?/h4>
在DecimalFormat API中有q样一D:
舍入 DecimalFormat 提供 RoundingMode 中定义的舍入模式q行格式化。默认情况下Q它使用RoundingMode.HALF_EVEN ?/p>
|
q句话指Z舍入模式有多U类型,而DecimalFormat默认采用?code>RoundingMode.HALF_EVENq种cdQ接下来Q我们就一L看,到底存在哪些舍入cd?/p>
RoundingMode介绍Q?/h4>
RoundingMode
是一个枚丄Q有一下几个常量:UPQDOWNQCEILINGQFLOORQHALF_UPQHALF_DOWNQHALF_EVENQUNNECESSARY
UP
public static final RoundingMode UP
- q离零方向舍入的舍入模式。始l对非零舍弃部分前面的数字加 1。注意,此舍入模式始l不会减计值的l对倹{?p style="margin: 0px; padding: 0px;">CZQ?/p>
输入数字 | 使用 UP 舍入模式 输入数字舍入ؓ一位数 |
---|
5.5 | 6 |
2.5 | 3 |
1.6 | 2 |
1.1 | 2 |
1.0 | 1 |
-1.0 | -1 |
-1.1 | -2 |
-1.6 | -2 |
-2.5 | -3 |
-5.5 | -6 |
DOWN
public static final RoundingMode DOWN
- 向零方向舍入的舍入模式。从不对舍弃部分前面的数字加 1Q即截尾Q。注意,此舍入模式始l不会增加计值的l对倹{?p style="margin: 0px; padding: 0px;">CZQ?/p>
输入数字 | 使用 DOWN 舍入模式 输入数字舍入ؓ一位数 |
---|
5.5 | 5 |
2.5 | 2 |
1.6 | 1 |
1.1 | 1 |
1.0 | 1 |
-1.0 | -1 |
-1.1 | -1 |
-1.6 | -1 |
-2.5 | -2 |
-5.5 | -5 |
CEILING
public static final RoundingMode CEILING
- 向正无限大方向舍入的舍入模式。如果结果ؓ正,则舍入行为类g RoundingMode.UPQ如果结果ؓ负,则舍入行为类g RoundingMode.DOWN。注意,此舍入模式始l不会减计倹{?p style="margin: 0px; padding: 0px;">CZQ?/p>
输入数字 | 使用 CEILING 舍入模式 输入数字舍入ؓ一位数 |
---|
5.5 | 6 |
2.5 | 3 |
1.6 | 2 |
1.1 | 2 |
1.0 | 1 |
-1.0 | -1 |
-1.1 | -1 |
-1.6 | -1 |
-2.5 | -2 |
-5.5 | -5 |
FLOOR
public static final RoundingMode FLOOR
- 向负无限大方向舍入的舍入模式。如果结果ؓ正,则舍入行为类g RoundingMode.DOWNQ如果结果ؓ负,则舍入行为类gRoundingMode.UP。注意,此舍入模式始l不会增加计倹{?p style="margin: 0px; padding: 0px;">CZQ?/p>
输入数字 | 使用 FLOOR 舍入模式 输入数字舍入ؓ一位数 |
---|
5.5 | 5 |
2.5 | 2 |
1.6 | 1 |
1.1 | 1 |
1.0 | 1 |
-1.0 | -1 |
-1.1 | -2 |
-1.6 | -2 |
-2.5 | -3 |
-5.5 | -6 |
HALF_UP
public static final RoundingMode HALF_UP
- 向最接近数字方向舍入的舍入模式,如果与两个相L字的距离相等Q则向上舍入。如果被舍弃部分 >= 0.5Q则舍入行ؓ?nbsp;RoundingMode.UPQ否则舍入行为同RoundingMode.DOWN。注意,此舍入模式就是通常学校里讲的四舍五入?p style="margin: 0px; padding: 0px;">CZQ?/p>
输入数字 | 使用 HALF_UP 舍入模式 输入数字舍入ؓ一位数 |
---|
5.5 | 6 |
2.5 | 3 |
1.6 | 2 |
1.1 | 1 |
1.0 | 1 |
-1.0 | -1 |
-1.1 | -1 |
-1.6 | -2 |
-2.5 | -3 |
-5.5 | -6 |
HALF_DOWN
public static final RoundingMode HALF_DOWN
- 向最接近数字方向舍入的舍入模式,如果与两个相L字的距离相等Q则向下舍入。如果被舍弃部分 > 0.5Q则舍入行ؓ?nbsp;RoundingMode.UPQ否则舍入行为同RoundingMode.DOWN?p style="margin: 0px; padding: 0px;">CZQ?/p>
输入数字 | 使用 HALF_DOWN 舍入模式 输入数字舍入ؓ一位数 |
---|
5.5 | 5 |
2.5 | 2 |
1.6 | 2 |
1.1 | 1 |
1.0 | 1 |
-1.0 | -1 |
-1.1 | -1 |
-1.6 | -2 |
-2.5 | -2 |
-5.5 | -5 |
HALF_EVEN
public static final RoundingMode HALF_EVEN
- 向最接近数字方向舍入的舍入模式,如果与两个相L字的距离相等Q则向相ȝ偶数舍入。如果舍弃部分左边的数字为奇敎ͼ则舍入行为同RoundingMode.HALF_UPQ如果ؓ偶数Q则舍入行ؓ?tt>RoundingMode.HALF_DOWN。注意,在重复进行一pd计算Ӟ此舍入模式可以在l计上将累加错误减到最。此舍入模式也称?#8220;银行家舍入法”Q主要在国使用。此舍入模式cM?Java 中对float ?tt>double 法使用的舍入策略?p style="margin: 0px; padding: 0px;">CZQ?/p>
输入数字 | 使用 HALF_EVEN 舍入模式 输入数字舍入ؓ一位数 |
---|
5.5 | 6 |
2.5 | 2 |
1.6 | 2 |
1.1 | 1 |
1.0 | 1 |
-1.0 | -1 |
-1.1 | -1 |
-1.6 | -2 |
-2.5 | -2 |
-5.5 | -6 |
UNNECESSARY
public static final RoundingMode UNNECESSARY
- 用于断言h的操作具有精结果的舍入模式Q因此不需要舍入。如果对生成_l果的操作指定此舍入模式Q则抛出 ArithmeticException?p style="margin: 0px; padding: 0px;">CZQ?/p>
输入数字 | 使用 UNNECESSARY 舍入模式 输入数字舍入ؓ一位数 |
---|
5.5 | 抛出 ArithmeticException |
2.5 | 抛出 ArithmeticException |
1.6 | 抛出 ArithmeticException |
1.1 | 抛出 ArithmeticException |
1.0 | 1 |
-1.0 | -1 |
-1.1 | 抛出 ArithmeticException |
-1.6 | 抛出 ArithmeticException |
-2.5 | 抛出 ArithmeticException |
-5.5 | 抛出 ArithmeticException |
http://blog.csdn.net/alanzyy/article/details/8465098

]]> - Java 多线E中的Q务分解机?ForkJoinPool例子http://www.aygfsteel.com/jlin/archive/2016/12/21/432163.htmlflyflyWed, 21 Dec 2016 14:37:00 GMThttp://www.aygfsteel.com/jlin/archive/2016/12/21/432163.html一、Q务分解问题和ForkJoinPool?/span>
在多U程q发~程中,有时候会遇到大d分解成小d再ƈ发执行的场景?a title="Java 知识? target="_blank" style="color: #df3434; text-decoration: none; font-weight: bold;">Java 8新增的ForkJoinPool很好的支持了q个问题?/span>
ForkJoinPool是一U支持Q务分解的U程池,当提交给他的d“q大”Q他׃按照预先定义的规则将大Q务分解成Q务,多线Eƈ发执行?/span>
一般要配合可分解Q务接口ForkJoinTask来用,ForkJoinTask有两个实现它的抽象类QRecursiveAction和RecursiveTaskQ其区别是前者没有返回|后者有q回倹{?/span>
下面通过具体代码Q来C两个问题Q(1Q怎么定义可分解的dc?Q?Q如何用ForkJoinPool
package demo.thread.fork;
import java.util.Random;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.Future;
import java.util.concurrent.RecursiveTask;
public class ForkJoinPoolDemo {
public static void main(String[] args) throws InterruptedException, ExecutionException {
int arr[] = new int[100];
Random random = new Random();
int total = 0;
// 初始?00个数字元?/p>
for (int i = 0; i < arr.length; i++) {
int temp = random.nextInt(100);
// Ҏl元素赋?q将数组元素的值添加到totald?/p>
total += (arr[i] = temp);
}
System.out.println("初始化时的d=" + total);
// 创徏包含Runtime.getRuntime().availableProcessors()q回gZ数的q行U程的ForkJoinPool
ForkJoinPool forkJoinPool = new ForkJoinPool();
// 提交可分解的PrintTaskd
Future<Integer> future = forkJoinPool.submit(new SumTaskDemo(arr, 0,
arr.length));
System.out.println("计算出来的d=" + future.get());
// 关闭U程?/p>
forkJoinPool.shutdown();
}
}
// RecursiveTask为ForkJoinTask的抽象子c,有返回值的d
class SumTaskDemo extends RecursiveTask<Integer> {
private static final long serialVersionUID = 4033241174438751063L;
// 每个"Q?最多只打印20个数
private static final int MAX = 20;
private int arr[];
private int start;
private int end;
SumTaskDemo(int arr[], int start, int end) {
this.arr = arr;
this.start = start;
this.end = end;
}
@Override
protected Integer compute() {
int sum = 0;
// 当end-start的值小于MAX时候,开始打?/p>
if ((end - start) <= MAX) {
for (int i = start; i < end; i++) {
sum += arr[i];
}
return sum;
} else {
System.err.println("=====d分解======");
// 大d分解成两个小d
int middle = (start + end) >>>1;
SumTaskDemo left = new SumTaskDemo(arr, start, middle);
SumTaskDemo right = new SumTaskDemo(arr, middle, end);
// q行执行两个Q?/p>
left.fork();
right.fork();
// 把两个小d累加的结果合qv?/p>
return left.join() + right.join();
}
}
}
例子二:
package demo.thread.fork;
import java.util.Random;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.RecursiveAction;
import java.util.concurrent.TimeUnit;
/**
* @author lin
*
*/
public class ForkJoinPoolDemo2 {
public static void main(String[] args) throws Exception {
// 创徏一个支持分解Q务的U程池ForkJoinPool
ForkJoinPool pool = new ForkJoinPool(4);
myTask task = new myTask(60);
pool.submit(task);
pool.awaitTermination(10, TimeUnit.SECONDS);// {待20sQ观察结?/p>
pool.shutdown();
}
}
/**
* 定义一个可分解的的dc,l承了RecursiveAction抽象c?必须实现它的computeҎ
*/
class myTask extends RecursiveAction {
private static final long serialVersionUID = 1L;
// 定义一个分解Q务的阈?#8212;—50,即一个Q务最多承?0个工作量
int THRESHOLD = 20;
// d?/p>
int task_Num = 0;
myTask(int Num) {
this.task_Num = Num;
}
@Override
protected void compute() {
if (task_Num <= THRESHOLD) {
System.out.println(Thread.currentThread().getName() + "承担?
+ task_Num + "份工?);
/*try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}*/
} else {
// 随机解成两个d
Random m = new Random();
int x = m.nextInt(50);
myTask left = new myTask(x);
myTask right = new myTask(task_Num - x);
left.fork();
right.fork();
}
}
}

]]>- Java求实际利率之Excel函数RATE(?http://www.aygfsteel.com/jlin/archive/2015/05/26/425305.htmlflyflyTue, 26 May 2015 03:06:00 GMThttp://www.aygfsteel.com/jlin/archive/2015/05/26/425305.htmlhttp://www.aygfsteel.com/jlin/comments/425305.htmlhttp://www.aygfsteel.com/jlin/archive/2015/05/26/425305.html#Feedback0http://www.aygfsteel.com/jlin/comments/commentRss/425305.htmlhttp://www.aygfsteel.com/jlin/services/trackbacks/425305.html在excel里有个函数RATE是求实际利率的,在网上搜|了半年Q公式倒是扑ֈ不少Q可以没有一个实现的法Q郁P自己研究Q写一个出来,做个备忘
公式Q?br />

上面的太复杂Q来个简单的Q?br />

使用JAVA求实际利?/p>
Java代码

- /**
- * 实际利率?/span>
- * @author Bean(mailto:mailxbs@126.com)
- * @param a 现?/span>
- * @param b q金
- * @param c 期数
- * @param cnt q算ơ数
- * @param ina 误差位数
- * @return 利率
- */
- public static double rate(double a,double b,double c,int cnt,int ina){
- double rate = 1,x,jd = 0.1,side = 0.1,i = 1;
- do{
- x = a/b - (Math.pow(1+rate, c)-1)/(Math.pow(rate+1, c)*rate);
- if(x*side>0){side = -side;jd *=10;}
- rate += side/jd;
- }while(i++<cnt&&Math.abs(x)>=1/Math.pow(10, ina));
- if(i>cnt)return Double.NaN;
- return rate;
- }
- public static void main(String agrs[]) {
- {
- Double 现?nbsp;= 7944760.00d;
- Double q金 = 186627.21d;
- Double 期数 = 48d;
-
- //计算200ơ,比Excel20ơ要_Q误差精到数点后10?/span>
- System.out.println(rate(现?q金,期数,200,10));
- }
- }
转: http://beanopen.iteye.com/blog/791878
]]> - JavaU程Q概念与原理(?http://www.aygfsteel.com/jlin/archive/2015/04/26/424684.htmlflyflySun, 26 Apr 2015 15:10:00 GMThttp://www.aygfsteel.com/jlin/archive/2015/04/26/424684.htmlhttp://www.aygfsteel.com/jlin/comments/424684.htmlhttp://www.aygfsteel.com/jlin/archive/2015/04/26/424684.html#Feedback0http://www.aygfsteel.com/jlin/comments/commentRss/424684.htmlhttp://www.aygfsteel.com/jlin/services/trackbacks/424684.html阅读全文

]]> - 疫苗QJava HashMap的死循环(?http://www.aygfsteel.com/jlin/archive/2015/01/30/422594.htmlflyflyFri, 30 Jan 2015 09:54:00 GMThttp://www.aygfsteel.com/jlin/archive/2015/01/30/422594.htmlhttp://www.aygfsteel.com/jlin/comments/422594.htmlhttp://www.aygfsteel.com/jlin/archive/2015/01/30/422594.html#Feedback2http://www.aygfsteel.com/jlin/comments/commentRss/422594.htmlhttp://www.aygfsteel.com/jlin/services/trackbacks/422594.html阅读全文

]]> - 深入理解java异常处理机制(?http://www.aygfsteel.com/jlin/archive/2015/01/30/422589.htmlflyflyFri, 30 Jan 2015 08:36:00 GMThttp://www.aygfsteel.com/jlin/archive/2015/01/30/422589.htmlhttp://www.aygfsteel.com/jlin/comments/422589.htmlhttp://www.aygfsteel.com/jlin/archive/2015/01/30/422589.html#Feedback1http://www.aygfsteel.com/jlin/comments/commentRss/422589.htmlhttp://www.aygfsteel.com/jlin/services/trackbacks/422589.html阅读全文

]]> - Myeclipse Enterprise Workbench 9.0破解Ҏ http://www.aygfsteel.com/jlin/archive/2014/08/09/416767.htmlflyflySat, 09 Aug 2014 14:39:00 GMThttp://www.aygfsteel.com/jlin/archive/2014/08/09/416767.htmlhttp://www.aygfsteel.com/jlin/comments/416767.htmlhttp://www.aygfsteel.com/jlin/archive/2014/08/09/416767.html#Feedback0http://www.aygfsteel.com/jlin/comments/commentRss/416767.htmlhttp://www.aygfsteel.com/jlin/services/trackbacks/416767.html2、下载工具包?a target="_blank" rel="nofollow" style="color: #386e00; text-decoration: none;">点击下蝲Q包?a target="_blank" rel="nofollow" style="color: #386e00; text-decoration: none;">publicKey.bytes和破解工?/a>Q?a href="/Files/jlin/myeclipse9_keygen_activator.zip">/Files/jlin/myeclipse9_keygen_activator.zip
3、在你安装Myeclipe的目录中Common\plugins\com.genuitec.eclipse.core_9.0.0.me201103181703.jarQ?br />用压~工h开QWinRAR?-zipQ我用的是WinMountQ再到com\genuitec\eclipse\core目录下,
替换publicKey.bytes文gQ?如图
![Myeclipse Enterprise Workbench 9.0破解Ҏ - leruge - 大学生刘? src=]()
4、修改ini配置文g。在MyEclipse 9.0\myeclipse.iniQ用C本开开Myeclipse.iniQ在最后加上下面两?/span>
-Dgenuitec.honorDevMode=true
-Dosgi.dev=true
5、打开MyeclipseQ在“preferences”Q即参数选择中)扑ֈ如图所C?/span>
![Myeclipse Enterprise Workbench 9.0破解Ҏ - leruge - 大学生刘? src=]()
6、运?/span>破解工具Q在下蝲的工具包中)。如?/span>
7、随便写一个用户名Q我的是lerugeQ,点击下面两个按钮Q将生成的东西写上就行了?/span>
8、到此Myeclipse Enterprise Workbench 9.0破解完毕?/span>
装:http://leruge.blog.163.com/blog/static/166845995201192474724627/

]]>
վ֩ģ壺
|
|
¹Ȫ|
|
ͳ|
ʯ|
|
ͻȪ|
ӡ|
|
|
|
|
|
|
ˮ|
ͺ|
캵|
|
˳|
ʩ|
ʶ|
ɽ|
|
կ|
Ӣ|
¬|
|
|
|
|
γ|
|
|
|
ض|
|
|
|
|
|