自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 字符串转字符数组

1 String s = "hello"; char[] strArray = s.toCharArray();//字符串转换成字符数组 System.out.println(strArray); 2 Java split() 方法,split() 方法根据匹配给定的正则表达式来拆分字符串 String str = "0,1,2,3,4"; Str...

2019-05-12 22:32:35 542

原创 字符数组转字符串

三种方法 char c[] = {‘s’,‘y’,‘n’,’ ',‘j’,‘a’,‘v’,‘a’}; 1. String s4 =new String(c); 2.//toString()方法 String str = null; for (int i=0 ;i<c.length ;i++){ str = sb2.append(c[i]).toSt...

2019-05-11 11:09:05 218

原创 二分查找法--有序表

思路:1.定义一个方法,再在main()方法里传入数组和自己想要查找的数。 2.二分法适用于有序表,首先将给的target与中间位置比较,相等则查找成功,不相等则在前半段或后半段。大于中间位置数在后半段,小于在前半段。缩小范围继续查找,直到找到为止,循环完毕还没有找到返回负一。 代码 public class BinarySearch { public static void main(Strin...

2019-05-11 09:55:18 2149

原创 快速排序

public static void quickSort(int[] arr,int low,int high){ int i,j,temp,t; if(low>high){ return; } i=low; j=high; //temp就是基准位 temp = arr[low]; while (i<j) { //先看右边,依次往左递减 whil...

2019-05-08 22:51:27 80

原创 冒泡排序

冒泡即是像小泡泡一样一点点排序小数一格一格挤上去,主要看for循环,外层循环控制排序趟数,内层循环控制每一趟排序多少次。 public static void main(String[] args) { int[] arr = {6, 3, 8, 2, 9, 1}; System.out.println(“排序前数组为:”); for (int num : arr) {//迭代器遍历 System...

2019-05-08 22:38:13 61

原创 选择排序

主要理解selectionSort()方法,两层循环,外层遍历所有数,内层遍历所有数加一,即除去前面已经遍历过的数 public class SelectionSort { public static void main(String args[]){ int[] a = {2,4,6,7,3,5,1,9,8}; print(a); System.out.println(); selectionS...

2019-05-08 22:30:32 89

空空如也

空空如也

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

TA关注的人

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