数组排序的Java实现(Sorting of arrays implemented with Java)
来源:互联网 发布:js仿ios地区选择器 编辑:程序博客网 时间:2024/04/27 04:14
//Find the largest 2 values in a set of values, using sorting algorithm
//Java how to program, 5/e, chapter 4
import javax.swing.*;
public class ModifiedMaximum ...{
public static void main(String args[])
...{
int MAX=10;
int[] number=new int[MAX];
int temp;
String[] gradeText=new String[MAX];
for (int counter=1;counter<=MAX;counter++)
...{
gradeText[counter-1]=JOptionPane.showInputDialog("Enter Number of No."+counter);
number[counter-1]=Integer.parseInt(gradeText[counter-1]);
}
for (int i=0;i<MAX;i++)
for (int j=i+1;j<MAX;j++)
if (number[i]<number[j])
...{temp=number[i];
number[i]=number[j];
number[j]=temp;
}
JOptionPane.showMessageDialog(null, "The two largest number are: "+number[0]+" and "+number[1],"Maximum",JOptionPane.INFORMATION_MESSAGE);
}
}
//Java how to program, 5/e, chapter 4
import javax.swing.*;
public class ModifiedMaximum ...{
public static void main(String args[])
...{
int MAX=10;
int[] number=new int[MAX];
int temp;
String[] gradeText=new String[MAX];
for (int counter=1;counter<=MAX;counter++)
...{
gradeText[counter-1]=JOptionPane.showInputDialog("Enter Number of No."+counter);
number[counter-1]=Integer.parseInt(gradeText[counter-1]);
}
for (int i=0;i<MAX;i++)
for (int j=i+1;j<MAX;j++)
if (number[i]<number[j])
...{temp=number[i];
number[i]=number[j];
number[j]=temp;
}
JOptionPane.showMessageDialog(null, "The two largest number are: "+number[0]+" and "+number[1],"Maximum",JOptionPane.INFORMATION_MESSAGE);
}
}
- 数组排序的Java实现(Sorting of arrays implemented with Java)
- 【LeetCode-面试算法经典-Java实现】【004-Median of Two Sorted Arrays(两个排序数组的中位数)】
- 排序 Sorting(java实现)
- java--数组排序(Arrays.sort())
- leetcode Median of Two Sorted Arrays java 两个排序数组的中位数
- leetcode解题之4. Median of Two Sorted Arrays java (两个排序数组的中位数)
- [Java]Arrays.sort() 数组排序
- Java数组排序Arrays.sort
- 【Java】Java Arrays类进行数组排序
- Java实现一维数组排序(冒泡、选择、插入、Arrays类)
- Java数组排序Arrays.sort,以及Comparator接口的用法
- 数组排序 java.util.Arrays类的sort方法
- java数组排序Arrays.sort,以及Comparator接口的用法
- Java数组排序Arrays.sort,以及Comparator接口的用法
- Java数组排序Arrays.sort,以及Comparator接口的用法
- Java数组排序Arrays.sort,以及Comparator接口的用法
- Java数组排序Arrays.sort,以及Comparator接口的用法
- Java Arrays类进行数组排序需要注意的事情
- 我在项目管理中关于需求分析的总结
- 尴尬的东航
- WINDOWS SERVER 2003的管理员Administrators的密码忘记,怎样去掉密码
- 项目总结
- 去掉迅雷广告_thunder5广告不见了~
- 数组排序的Java实现(Sorting of arrays implemented with Java)
- EJB3.0学习笔记之一
- Java编程那些事儿7——进制的概念
- IBM着力"去贵族化"更加重视"小生意"
- EJB3.0学习笔记之二 Session Bean的生命周期
- HTML dir 属性
- Eclipse插件开发
- 网页制作常用代码
- 解决交通拥堵 黑石礁至高新园区将修高架路等