解决方案 »
- 读取src文件中的xml文件问题
- struts hidden的问题
- 这个错误的原因是什么?高分悬赏提供正确解决方案的朋友
- 谁能给个首页struts2显示的最佳方案?首页显示多个不同的对象列表。如何在应用加载就加载各对象存入session。急!!!!
- j2ee中上传下载小技术如何实现
- 用java做web的项目,是不是就是在进行jsp开发啊
- 请教一个多表查询的问题
- 请教.struts中<bean:write>的问题?Cannot find bean TopAction in scope reques
- Java用Xpath解析XML遇到一个问题?求大神帮忙解决一下
- 请问上传视频怎么对视频进行改变编码(使用java的方式)
- 各位大神,请教一个问题,求指点,谢谢!
- java 后台返回大量记录,且记录的字段有段落、样式等,用什么方式返回显示好?
* 数组排序(升序),返回排序后数组值在原数组中的下标形成的下标数组(使用冒泡排序思想实现)
*
* @param array
* int[]:待排序数组
* @return int[] :排序后数组值在原数组中的下标形成的下标数组
*/
public static int[] bubbleSort1(int[] array) {
int[] indexArray = new int[array.length];
for (int i = 0; i < indexArray.length; i++) {
indexArray[i] = -1;
}
for (int i = 0; i < array.length; i++) {
int count = 0;
for (int j = 0; j < array.length; j++) {
if (i != j && array[i] > array[j]) {
count++;
}
}
while (indexArray[count] != -1) {
count++;
}
indexArray[count] = i;
}
return indexArray;
}/**
* @param args
*/
public static void main(String[] args) {
int[] array = { 20, 15, 7, 9, 80, 88, 54, 20, 67, 24 };
int[] indexArray = bubbleSort1(array);
for (int i = 0; i < indexArray.length; i++) {
System.out.println(array[indexArray[i]]);
}
}