每天一点基础

 

1)Math.ceil()执行向上取整,输出4

public static void main(String[] args) {
	System.out.println(Math.ceil(3.2));
}
}

2)Math.floor()执行向下取整,输出3

public static void main(String[] args) {
	System.out.println(Math.floor(3.2));
}
}

3)Math.round()执行四舍五入,输出3和4

public static void main(String[] args) {
	System.out.println(Math.round(3.2));
	System.out.println(Math.round(3.5));
}
}

4)基本类型 转换为Integer对象
  1、  Integer in1=new Integer(10);
    2、Integer in2=Integer.valueOf(20);

    Integer对象转换成int
    1、int a=in1.intValue();


    字符串转换成Integer对象
    Integer in3=Integer.parseInt("324");
    Integer in4=new Integer("999");
    
    //Integer对象转换成字符串
     String  str1=in3.toString();

5)StringBuffer和StringBuilder在频繁字符串修改失效测试

StringBuffer:线程安全 但是效率低

StringBuilder:线程不安全 但是效率高(一般用它)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值