# 冒泡排序法复习下,反编译后的结果很意外

11年前

`class maopao  {   public static void main(String[] args)   {    int[] array = {3,7,8,1,4,65,5,243,55,44};    int j = 0;    for (int i = 0; i < array.length - 1; ++i)    {     for (j = i + 1; j < array.length; ++j)     {      if (array[i] < array[j])      {       array[i] += array[j];       array[j] = array[i] - array[j];       array[i] -= array[j];      }     }    }    for (int x : array)    {     System.out.printf("%4d",x);    }   }  }  `

`class maopao  {    public static void main(String[] paramArrayOfString)    {      int[] arrayOfInt1 = { 3, 7, 8, 1, 4, 65, 5, 243, 55, 44 };      int i = 0;      for (int j = 0; j < arrayOfInt1.length - 1; j++)      {        for (i = j + 1; i < arrayOfInt1.length; i++)        {          if (arrayOfInt1[j] >= arrayOfInt1[i])            continue;          arrayOfInt1[j] += arrayOfInt1[i];          arrayOfInt1[j] -= arrayOfInt1[i];          arrayOfInt1[j] -= arrayOfInt1[i];        }      }        for (int n : arrayOfInt1)      {        System.out.printf("%4d", new Object[] { Integer.valueOf(n) });      }    }  }`

`class maopao  {      public static void main(String[] strings)   {    int[] is = { 3, 7, 8, 1, 4, 65, 5, 243, 55, 44 };    boolean bool = false;    for (int i = 0; i < is.length - 1; i++)    {     for (int i_0_ = i + 1; i_0_ < is.length; i_0_++)     {      if (is[i] < is[i_0_])      {       is[i] += is[i_0_];       is[i_0_] = is[i] - is[i_0_];       is[i] -= is[i_0_];      }     }    }    int[] is_1_ = is;    int i = is_1_.length;    for (int i_2_ = 0; i_2_ < i; i_2_++)    {     int i_3_ = is_1_[i_2_];     System.out.printf("%4d", new Object[] { Integer.valueOf(i_3_) });    }      }  }`

Java自带的javap反编译出来时看不到完整代码,只能看到类,方法,属性的定义.
`Compiled from "maopao.java"  class maopao extends java.lang.Object  {      maopao();      public static void main(java.lang.String[]);  }`
`public static void main(String[] paramArrayOfString)  {   int[] arrayOfInt1 = { 1, 3, 5, 2, 9, 10, 23, 11 };   int i = 0;   int k;   for (int j = 0; j < arrayOfInt1.length - 1; j++)   {    for (k = j + 1; k < arrayOfInt1.length; k++)    {     if (arrayOfInt1[k] <= arrayOfInt1[j])      continue;     i = arrayOfInt1[j];     arrayOfInt1[j] = arrayOfInt1[k];     arrayOfInt1[k] = i;    }   }  }`