数组的排序,冒泡排序法,选择,直接,希尔,基本类型的包装类。

 冒泡排序:

    数组的排序,冒泡排序法,选择,直接,希尔,基本类型的包装类。

Arrays类的概述和方法使用

    成员方法:
    public static String toString(int[] a)
    public static void sort(int[] a)
    public static int binarySearch(int[] a,int key)

  数组的排序,冒泡排序法,选择,直接,希尔,基本类型的包装类。

基本类型包装类的概述

基本类型和包装类的对应:

                                                 基本类型                                        基本类型的包装类

byte Byte
short Short

int

 

Integer
long Long
float Float
double Double
char Character
boolean Boolean

 将100转换成二进制 , 八进制 , 十六进制

    案例演示:

数组的排序,冒泡排序法,选择,直接,希尔,基本类型的包装类。

自动装箱和拆箱

   案例演示:

       数组的排序,冒泡排序法,选择,直接,希尔,基本类型的包装类。

  

    看程序写结果
    
    Integer i1 = new Integer(127);
    Integer i2 = new Integer(127);
    System.out.println(i1 == i2);//false
    System.out.println(i1.equals(i2));//true
    System.out.println("-----------");

    Integer i3 = new Integer(128);
    Integer i4 = new Integer(128);
    System.out.println(i3 == i4);//false
    System.out.println(i3.equals(i4));//true
    System.out.println("-----------");

    Integer i5 = 128;
    Integer i6 = 128;
    System.out.println(i5 == i6);//false  因为 超过了一个字节的范围 会new 一个Integer对象
    System.out.println(i5.equals(i6));//true
    System.out.println("-----------");

    Integer i7 = 127;
    Integer i8 = 127;
    System.out.println(i7 == i8);//true 没有超过一个字节的范围 因为在方法区中存在一个 字节常量池 范围-128---127
    System.out.println(i7.equals(i8));//true