tzkr.net
当前位置:首页 >> JAvA题,有数组 int[] Arr={5.2.3.4.9.8.7.1} 请编... >>

JAvA题,有数组 int[] Arr={5.2.3.4.9.8.7.1} 请编...

public static void main(String[] args) throws Exception { int[] arr={5,2,3,4,9,8,7,1}; insertSort(arr);}/** * @param array插入排序算法待排数组 */static void insertSort(int ...array){int i,j,temp;for(i=1;i

int[][] number = {{1,2,3},{4,5,6},{7,8,9}};int[][] newnumber = new int[number[0].length][number.length];for(int i = 0;i

int arry[]={2,1,4,3,7,9,6};Arrays.sort(arry);for(Integer a : arry) {System.out.println(a);}

public static void main(String[] args) { int a[][]={{1,2,3,4},{2,3,4,5},{3,4,5,6}}; int b[][]=new int[4][3]; for (int i = 0; i < a.length; i++) { for (int j = 0; j < a[i].length; j++) { b[j][i]=a[i][j]; } } for (int i = 0; i <...

int[] number =new int[] {1,2,3,4,5}; foreach(int i in number){ if(i ==3){ continue; } if(i==5){ break; } }

int[] arr1={1,3,4,5,6};int[] arr2;arr2=Arrays.copyOf(arr1, 4);for (int i = 0; i < arr1.length; i++) {System.out.print(arr1[i]);}System.out.println();for (int i = 0; i < arr2.length; i++) {System.out.print(arr2[i]);}

public static void test1(){ Integer[] s = {1,3,5,7,9,11,13,15,17,19}; Comparator cmp = new MyComparator(); Arrays.sort(s, cmp); for(Integer i:s){ System.out.println(i); } } static class MyComparator implements Comparator { @Ove...

这是if语句里面错了,应该是(i==j||i+j==2);

void reverse(int *arr, int count) { int *p = arr, *q = arr + count; while (p < q) { int t = *p; *p = *q; *q = t; p++; q--; }}void main() { int c[10]= {1,2,3,4,5,6,7,8,9,10}; reverse(c, 10);}

网站首页 | 网站地图
All rights reserved Powered by www.tzkr.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com