随笔分类 -  java_算法

摘要:1 package search; 2 3 /** 4 * 二分查找又称折半查找,它是一种效率较高的查找方法。 5 【二分查找要求】:1.必须采用顺序存储结构 2.必须按关键字大小有序排列。 6 * @author Administrator 7 * 8 */ 9 public class BinarySearch { 10 public static void main(String[] args) {11 int[] src = new int[] {1, 3, 5, 7, 8, 9}; 12 System.out.println(... 阅读全文
posted @ 2012-10-09 14:06 雲端之風 阅读(239) 评论(0) 推荐(0) 编辑
摘要:import java.io.ByteArrayInputStream;import java.io.ByteArrayOutputStream;import java.io.IOException;import java.util.regex.Matcher;import java.util.regex.Pattern;import java.util.zip.ZipEntry;import java.util.zip.ZipInputStream;import java.util.zip.ZipOutputStream;import sun.misc.BASE64Decoder;publi 阅读全文
posted @ 2012-10-08 17:35 雲端之風 阅读(441) 评论(0) 推荐(0) 编辑
摘要:package service;import java.util.regex.Matcher;import java.util.regex.Pattern;public class CodeChange {/* * 把中文字符串转换为十六进制Unicode编码字符串 */ public static String stringToUnicode(String s) { String str = ""; for (int i = 0; i < s.length(); i++) { int ch = (int) s.charAt(i); if (ch > 255) 阅读全文
posted @ 2012-08-13 14:57 雲端之風 阅读(3516) 评论(0) 推荐(1) 编辑
摘要:package net.oschina.tester;public class ToUnicode { /** * @param args */ public static void main(String[] args) { System.out.println(toUnicode("汉字转换")); } public static String toUnicode(String s) { String as[] = new String[s.length()]; String s1 = ""; for (int i = 0; i < s.len 阅读全文
posted @ 2012-08-13 14:55 雲端之風 阅读(511) 评论(0) 推荐(1) 编辑
摘要:package sort;public class BubbleSort { private int[] array; private int maxSize; public BubbleSort(int maxSize) { this.array = new int[maxSize]; this.maxSize = maxSize; } private int[] getRandomNum() { for (int i = 0; i < maxSize; i++) { array[i] = (int) Math.round(Math.random() * 1000); } re... 阅读全文
posted @ 2012-07-25 16:44 雲端之風 阅读(557) 评论(1) 推荐(0) 编辑

点击右上角即可分享
微信分享提示