findBugs记录

1 在0-n之间取随机数,使用
java.util.Random r=new java.util.Random();
r.nextInt(n);
而不使用
(int)(r.nextDouble() * n)
If r is a java.util.Random, you can generate a random number from 0 to n-1 using r.nextInt(n), rather than using (int)(r.nextDouble() * n).
2 在实例中修改静态类的属性
public void process(File fs) {
UtilTools.rootPath = "d:/tmp/";
...
This instance method writes to a static field. This is tricky to get correct if multiple instances are being manipulated, and generally bad practice

你可能感兴趣的:(java)