public class PaiXu1 { public static void main(String[] args) { int[] s = {345,879,456,870,221,902,148,234,478}; System.out.println("排序之前:"); System.out.println(Arrays.toString(s)); System.out.println("排序之后:"); int temp = 0; for (int i
完成几个小代码练习?让自己更加强大?学习新知识回顾一下基础? 1.输入数组计算最大值 2.输出数组反向打印 3.求数组平均值与总和 4.键盘输两int,并求总和 5.键盘输三个int,并求最值 /* 要求:输入一组数组,计算出最大值. */ public class cesi{ public static void main (String[] args) { int[] array = {5, 15, 100, 999, 1000}; int max = array[0]; for (int
1.数组的冒泡排序 public void bubbleSort(int a[]) { int n = a.length; for (int i = 0; i < n - 1; i++) { for (int j = 0; j < n - 1; j++) { if (a[j] > a[j + 1]) { int temp = a[j]; a[j] = a[j + 1];
package zuoYe; import java.util.Scanner; public class MaxSubArray { public static void main(String[] args) { Scanner scan = new Scanner(System.in); //输入数据 System.out.println("请输入数组长度"); int n = scan.nextInt(); int[] a = new int[n]; System.out.pr
java 对象数组 from zhaocundang@163.com 先 用类声明数组: 再把类的实例赋给数组: package works; import java.util.Scanner; public class test { public static void main(String[] args) { manage m = new manage(); m.input(); m.output(); m.select_sort(); } } class student{ int sno
面试题查找重复元素并打印重复次数和重复位置,一顿懵逼,回来死磕写下来,打印指定重复次数和最大次数,其他在此基础上可以再更新 package sort; import org.testng.annotations.Test;import sun.org.mozilla.javascript.internal.ast.NewExpression; import java.util.*; /** * Created by liangwei on 2018/10/18. */public class S