zoukankan      html  css  js  c++  java
  • 常用类及其方法应用

    Math类(计算)、Arrays类(排序等)、BigInteger类(精确整数)、BigDecimal类(精确浮点数)

    ----------------------------------------------------------------------------------------------------------------

    Integer类

        将String类型转换为int类型:

         (方式1):   int i=Integer.parseInt(s);

         (方式2):  String-->Integer-->int 

                       Integer.valueOf(s).intValue();

       将int类型转换为String类型

                      String s=String.valueOf(i);

    --------------------------------------------------------------------------------------------

    Character类

       判断功能:

            1. isDigit(char ch): 是否是数字

            2. isUpperCase(char ch):是否是大写

            3. isLowerCase(char ch):是否是小写

    ----------------------------------------------------------------------------------

    System类

         System.exit(0):正常终止虚拟机;

         System.currentTimeMillis():主要用于记录一段代码运行的时间

    -------------------------------------------------------------------------------------

    DateFormat类

       一、 format(Date d):把Date类型转换为String类型

        实现代码:new SimpleDateFormat(format).format(d);

       二、 parse(String date):把String类型转换为Date类型

        实现代码:new SimpleDateFormat(format).parse(date);

    ----------------------------------------------------------------------------------------

     SimpleDateFormat:

        构造方法:Public SimpleDateFormat(String format)

                      其中format就是转换的格式

    ps:SimpleDateFormat extends DateFormat

      --------------------------------------------------------------------------------------

    Date:

        1.从一个Date得到毫秒值(可以用作id)

              long time=new Date().getTime();

       2.从一个毫秒值转换为Date

              Date d1=d.setTime(time);

  • 相关阅读:
    UVA 10600 ACM Contest and Blackout(次小生成树)
    UVA 10369
    UVA Live 6437 Power Plant 最小生成树
    UVA 1151 Buy or Build MST(最小生成树)
    UVA 1395 Slim Span 最小生成树
    POJ 1679 The Unique MST 次小生成树
    POJ 1789 Truck History 最小生成树
    POJ 1258 Agri-Net 最小生成树
    ubuntu 用法
    ubuntu 搭建ftp服务器,可以通过浏览器访问,filezilla上传文件等功能
  • 原文地址:https://www.cnblogs.com/yuefeng123/p/7336908.html
Copyright © 2011-2022 走看看