A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

public class TestSystem {

        /**
         * @param args
         */
        public static void main(String[] args) {
                //返回当前时间毫秒值
                long l = System.currentTimeMillis();
                System.out.println(l);
                //获取当前系统的属性值
                System.out.println(System.getProperties());
               

        }

}
import java.util.Random;

public class TestRandom {

        /**
         * @param args
         */
        public static void main(String[] args) {
                Random r = new Random();
                Random r1 = new Random(646165);
                Random r2 = new Random(646165);
               
                double double1 = r.nextDouble();
                double double2 = r1.nextDouble();
                double double3 = r2.nextDouble();
                System.out.println(double1);
                System.out.println(double2);
                System.out.println(double3);
                System.out.println(r.nextInt(30)+90);

               
        }

}
public class TestMath1 {

        /**
         * 需求:使用Math类中的方法,Math中的类都是静态的,可以由类名直接调用.
         */
        public static void main(String[] args) {
                // TODO Auto-generated method stub
                        //圆周率
                System.out.println(Math.PI);
                //自然对数的底数
                System.out.println(Math.E);
                //求绝对值
                        int i = -1;
                        System.out.println(Math.abs(i));
                //天花板,向上取整
                        double d = 1.4234223;
                System.out.println(Math.ceil(d));
                //地板,向下取整
                System.out.println(Math.floor(d));
                //四舍五入
                System.out.println(Math.round(d));
                //a的b次幂
                System.out.println(Math.pow(d, i));
        }

}

0 个回复

您需要登录后才可以回帖 登录 | 加入黑马