自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(7)
  • 收藏
  • 关注

原创 Java数组整体左右移动

//右移public class Test { public static void main(String[] args) { int[] nums = {1,2,3,4,5,6,7,8,9,10}; int m = 8; for (int a : nums){ System.out.print(a + " "); } System.out.println(); int[].

2022-03-08 09:41:08 769

原创 验证:一个偶数总可以分为两个素数之和

import java.util.Scanner;public class Test02 { public static void main(String[] args) { Scanner s = new Scanner(System.in); System.out.println("请输入一个偶数:"); int a = s.nextInt(); if (a % 2 == 0){ add(a); .

2021-11-02 09:19:42 191

原创 输入10个整数,找出最大值、最小值、平均值,并反向输出

import java.util.Scanner;public class Test { public static void main(String[] args) { int[] num = new int[10]; Scanner in = new Scanner(System.in); System.out.print("输入10个整数:"); for (int i = 0; i < num.length; i++).

2021-10-26 10:07:02 3938

原创 日期的格式化

import java.text.SimpleDateFormat;import java.util.Date;public class DateTest01 { public static void main(String[] args) throws Exception { Date nowTime = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss .

2021-08-19 14:45:53 81

原创 JAVA二分法查找代码实现

public class ArrayUtil { public static void main(String[] args) { int[] arr = {100, 200, 230, 235, 600, 1000, 2000, 9999}; int index = binarySearch(arr,100); System.out.println(index == -1 ? "该元素不存在!" : "该元素的下表为" + index); .

2021-08-10 17:34:42 38

原创 JAVA选择排序

public class SelectSort { public static void main(String[] args) { int[] arr = {8, 6, 2, 4, 1}; //选择排序 for (int i = 0; i < arr.length-1; i++) { int min = i; for (int j = i + 1; j < arr.length; j++).

2021-08-09 18:31:48 30

原创 JAVA的冒泡排序

import java.util.Arrays;public class BubbleSort { public static void main(String[] args) { int[] arr = {9, 8, 7, 6, 5, 4, 3, 2, 1, 0}; //int count = 0; for (int i = arr.length-1; i > 0 ; i--) { for (int j = 0; .

2021-08-09 17:06:21 66

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除