Java基础
文章平均质量分 54
forai
这个作者很懒,什么都没留下…
展开
-
二分查找
public static void main(String[] args) { int[] num = {6,5,9,8,45,2,3,55,1}; Arrays.sort(num);//升序排序 int left = 0;//左边开始 int right = num.length;//右边开始 int key = 55;//要查找的 int midd原创 2013-11-29 13:15:08 · 421 阅读 · 0 评论 -
Java 文件和byte数组转换
public class T3 { public static void main(String[] args){ String filePath = "E:\\softoon\\workspace_softoon\\TestMobile\\src\\1.docx"; String outFilePath = "E:\\softoon\\workspace_softoon\\T原创 2013-11-29 13:15:49 · 415 阅读 · 0 评论 -
文件路径分隔符
String sep = File.separator // 系统有关的默认名称分隔符,字符串类型。 //file:/E:/softoon/workspace_softoon/TestMobile/bin/ System.out.println(ConfigUtil.class.getClassLoader().getResource("")); //file:/E:/原创 2013-11-29 13:14:57 · 1108 阅读 · 0 评论 -
冒泡排序
public static void main(String[] args) { int[] num = {6,5,9,8,45,2,3,55,1};// Arrays.sort(num); for (int i = 0; i < num.length-1; i++) { for (int j = i+1; j < num.length; j++) { if(n原创 2013-11-29 13:14:52 · 464 阅读 · 0 评论 -
Java IO 操作相关记录
//读文件 BufferedReaderBufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(new File("fileUrl"))));String tempStr = "";while((tempStr = br.readLine())!=null){ System.out.p原创 2013-02-04 11:19:48 · 364 阅读 · 0 评论 -
RSA加密解密和数字签名
上网研究了一下RSA加密解密和作为数字签名的用法,整理了一下,写了一个类,总结了用法。用到了commons-codec-1.6.jar的Base64类package tj.rsa_pkcs;import java.io.ByteArrayInputStream;import java.io.ByteArrayOutputStream;import java.io.InputStre原创 2015-04-16 17:28:41 · 1224 阅读 · 0 评论