API text|lang

java.lang
    String,StringBuffer,StringBuilder,Math
    Math:
    近似值
                        3    3.4999    3.6
    double ceil(double a)        3    4        4   
    double round(double a)        3    3        4
    double floor(double a)        3    3        3
 
    double n = 3.68;
    int n2 = (int)Math.ceil(n);
    abs()绝对值
    pow(底数,指数)幂运算
    sqrt()开平方
    random()随机小数(0-1)
 
    sin(double 弧度)
    cos(double 弧度)
    asin(double 弧度)
 
 
 

 
java.text
    Format(String format(obj), Object parse(String))
        NumberFormat
            DecimalFormat
 
        DateFormat
            SimpleDateFormat
 
Object类
    所有类的根类
    自定义类,一般常要重写的方法
    String toString():对此类对象的字符串描述
    boolean equals(Object obj):此对象是不是等于指定对象
    int hasCode():返回此对象的一个唯一数字标识
 
八大包装类
    原始类型:boolean    byte char         short     int     long float     double
    包装类型:Boolean   Byte Character    Short    Integer    Long Float    Double
 
Byte:此类的对象包装了一个byte值。 
Byte 类将基本类型 byte 的值包装在一个对象中。一个 Byte 类型的对象只包含一个类型为 byte 的字段。
 
此外,该类还为 byte 和 String 的相互转换提供了几种方法,并提供了处理 byte 时非常有用的其他一些常量和方法。
 
 
byte byteValue()
          作为一个 byte 返回此 Byte 的值。
double doubleValue()
          作为一个 double 返回此 Byte 的值。
float floatValue()
          作为一个 float 返回此 Byte 的值。
int intValue()
          作为一个 int 返回此 Byte 的值。
long longValue()
          作为一个 long 返回此 Byte 的值。
short shortValue()
          作为一个 short 返回此 Byte 的值。
 
数字格式字符串(进制不同,基数不同)与byte类型转换
static byte parseByte(String s)
          将 string 参数解析为有符号的十进制 byte。
static byte parseByte(String s, int radix)
          将 string 参数解析为一个有符号的 byte,其基数由第二个参数指定。
示例:
    "10"这样的字符串,得到一个byte值
    基数是11:
    byte b = Byte.parseByte("11");//结果11
    或
    byte b = Byte.parseByte("11",10);//结果11
    基数是:16(十六进制)
    byte b = Byte.parseByte("11",16);//结果17
    基数是:2(二进制)
    byte b = Byte.parseByte("11",2);//结果3
 
static Byte decode(String nm)
          将 String 解码为 Byte。
    //引子:java中表示一个数:10, 0xA09,010
    示例:
    "0x10"这样的字符串,得到一个byte值
    btye b = Byte.decode("0x10");//不需要指定基数,0x打头就是十六进制数。
 
//将一个byte值,数字字符串,数字字符串加基数作为参数,获得一个Byte对象
static Byte valueOf(byte b)
          返回表示指定 byte 值的一个 Byte 实例。
static Byte valueOf(String s)
          返回一个保持指定 String 所给出的值的 Byte 对象。
static Byte valueOf(String s, int radix)
          返回一个 Byte 对象,该对象保持从指定的 String 中提取的值,该值是在用第二个参数所给定的基数对指定字符串进行解析时提取的。
 
 
 
 
 int compareTo(Byte anotherByte)
          在数字上比较两个 Byte 对象。
 
 
 boolean equals(Object obj)
          将此对象与指定对象比较。
 
 int hashCode()
          返回此 Byte 的哈希码。
 
 
 
 String toString()
          返回表示此 Byte 的值的 String 对象。
static String toString(byte b)
          返回表示指定 byte 的一个新 String 对象。
 
 
 
 

StringBuffer
String
 
public class Demo7 {
    public static void fun(String s1, StringBuffer s2){
       s1 = s1.replace("a", "A");
       s2.replace(0, 1, "A");    
       
    }
    public static void main(String[] args) {
       String str1 = new String("abcaaabv");
       StringBuffer str2 = new StringBuffer("abcaaabv");
       fun(str1, str2);
       System.out.println(str1);//不变,String是不可变
       System.out.println(str2);//变
    }
}

int n = 199;
       //显示他的二进制,八进制,十六进制形式
       String hexN = Integer.toHexString(n);
       System.out.println("199的十六进制:"+hexN);
       System.out.println("199的八进制:"+Integer.toOctalString(n));
       System.out.println("199的二进制:"+Integer.toBinaryString(n));
 
 
 
 
 
 
 
原文地址:https://www.cnblogs.com/zachary7/p/8191531.html