package day8
;
public class lianxi1
{
public static void main(String
[] args
)
{
int[] arr
= {9,10,6,6,1,9,3,5,6,4};
int count
= arr
.length
;
for(int i
=0; i
<count
; i
++)
{
for(int j
=i
+1; j
<count
; j
++)
{
if(arr
[i
] == arr
[j
])
{
for(int k
=j
; k
<count
-1; k
++)
arr
[k
] = arr
[k
+1];
count
--;
}
}
}
int[] newArr
= new int[count
];
for(int i
=0; i
<count
; i
++)
newArr
[i
] = arr
[i
];
for(int i
=0; i
<count
; i
++)
System
.out
.print(newArr
[i
] + " ");
}
}
转载请注明原文地址:https://tech.qufami.com/read-21365.html