public class tri_a_bulles_array{이 프로그램이 어떻게 생겼는지 봅시다:
public static void main(String[] args) {
int T[] = {99, 45, 68, 18, 34, 26, 50, 8, 55, 10};
System.out.print("정렬하기 전에 ");
for (int n:T)
System.out.print(n+" ");
T = tri_a_bulles(T);
System.out.print("\n정렬 후 ");
for (int n:T)
System.out.print(n+" ");
}
정적 int[] tri_a_bulles(int T[])
{
int temp;
for(int i = T.length-1 ; i>=1 ; i--)
{
for(int j = 0 ; j< 나는; j++)
if(T[j] > T[d+1])
{
온도 = T[d+1];
T[j+1]=T[j];
T[j]=온도;
}
}
반환 T;
}
}
정렬하기 전에 99 45 68 18 34 26 50 8 55 10정렬 방법을 보려면 더 나아갈 수 있습니다. Java 사전 정의 java.util.Arrays Arrays.sort() 및 Collections.sort().
정렬 후 8 10 18 26 34 45 50 55 68 99
Please disable your ad blocker and refresh the window to use this website.