本帖最后由 房宝彬 于 2012-1-8 10:35 编辑
- public class HeiMaa
- {
- public static void main (String[] args)
- {
- int[] b = {4,6,8,99,2,44,5,11};
- int s= daxiao(b);
- System.out.println(s);
- xuanze(b);
-
- }
- public static int daxiao (int[] a)
- {
- int max = a[0];
- for(int x=1;x<a.length;x++)
- {
- if(a[x]<max)
- {
- max=a[x];
- }
- }
- return max;
- }
- public static void xuanze (int[] s)
- {
- for(int a=0;a<=s.length-1;a++)
- {
- for(int y=a+1;y<=s.length;y++)
- {
- if(s[a]>s[y])
- {
- int sum=s[a];
- s[a]=s[y];
- s[y]=sum;
- }
- }
- }
- }
- }
复制代码 请帮我看看哪里错了 |