package function;
public class JavaFunction {
public static void main(String[] args) {
// TODO Auto-generated method stub
//math
System.out.println(Math.floor(-1.8));//取整,返回小于目标函数的最大整数,如下将会返回
System.out.println(Math.ceil(-1.8));//取整,返回发育目标数的最小整数
System.out.println(Math.round(-1.8));//四舍五入取整数
System.out.println(Math.sqrt(9));//计算平方根
System.out.println(Math.cbrt(27));//计算立方根
System.out.println(Math.exp(2));//回欧拉数e的n次幂
System.out.println(Math.pow(2,3));//乘方(前底数,后指数)
System.out.println(Math.log(10));//自然对数(java只支持自然对数,需要使用换底公式logx(y) =loge(x) / loge(y))
System.out.println(Math.log(8)/Math.log(2));//以2为底8的对数
System.out.println(Math.abs(-10.8));//计算绝对值
System.out.println(Math.max(-10.8,8.8));//计算绝对值(只能支持两个数据比较)
System.out.println(Math.min(-10.8,8.8));//计算绝对值(只能支持两个数据比较)
System.out.println(Math.random());//返回一个伪随机数,该数大于等于0.0并且小于1.0
//math
//缺保留小数情况下的四舍五入
//string
String strE1 = new String(" you jump, I jump ");//声明变量
String strE2 = new String("GREEN");//声明变量
String strC1 = new String("可怜无定河边骨");//声明变量
String strC2 = new String("犹是深闺梦里人");//声明变量
System.out.println(strC2.length());//字符串长度,支持中文 返回结果 int
System.out.println(strC1.charAt(5));//英文字母下截取指定位置的一个字符,从0开始 返回结果 int
System.out.println(strC1.indexOf("河边",2));//从指定位置寻找指定字符.没有找到返加-1 返回结果 int
System.out.println(strE1.equalsIgnoreCase(strE2));//从指定位置寻找指定字符.没有找到返加-1 返回结果 boolean
System.out.println(strE1.toUpperCase());//字符串改大写 返回结果 String
System.out.println(strE1.toLowerCase());//字符串改大写 返回结果 String
System.out.println(strE1.trim());//删除字符串前的空格 返回结果 String
System.out.println(strE1.replace("ump",strE2));//从指定位置寻找指定字符.没有找到返加-1 返回结果 String
//string
}
}