`
zeyuphoenix
  • 浏览: 55696 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论
文章列表
public class NodeTest { /** 得到Node,两个元素,一个为值,一个为指向下个值的指针。 */ static private class Node { public int data; public Node nextNode; } /**得到链表的总数,正向计数得到总数-k*/ private static int findNode(Node headNode, int k) { int count = 0; Node node = headNode; while (node.nextNode != ...
1 2 2 3 4 5生成4不在第3位 3 5不相邻的不重复的6位数 public class CreateNum { // ****************************************************************************** private int[] numbers = new int[] { 1, 2, 2, 3, 4, 5 }; public int n; private String lastResult = ""; private boolean validate(String s) ...

排序备忘

import java.util.Arrays; /** * The Class Sort. */ public class Sort { /** * The main method. * * @param args * the args */ public static void main(String[] args) { int[] arrs = new int[] { 121, 32, 14, 125, 638, 119, 230, 469 }; bubbleSort(arrs.clone()); ...
字符串循环比较 /** * @param args */ public static void main(String[] args) { String root = "AABBCD"; String compare = "CDAA"; System.out.println(compareString(root, compare)); } public static boolean compareString(String root, String compare) { if (compare. ...
public static void main(String[] args) { String df = "/udd/itnms/file/123dd.dd.pdf"; System.out.println(changeFileType(df)); Properties d = new Properties(); System.out.println(d.getProperty("key")); String ttt = "ff_d.22.2.txt"; ...
/** * md5 common class<br> * MD5.java * @author <br> * 2007/11/19 11:51:59 */ public class MD5 { /** * MD5 instance class */ private static MD5 instance = null; // MD5 private MessageDigest _md5 = null; /** * MD5 instance get. * @return MD5 ...
/** * LoadXMl.java * @author <br> * 2007/11/09 13:49:35 */ public class LoadXMl { /** * LoadXMl */ public LoadXMl() { } /** * LoadXMl * @param fullPath * @return Properties * @throws Exception */ public static Properties loadProperties(String ...
/** * JTextField input Check * * @author shuai.zhang */ public class InputCheck extends KeyAdapter { /** * check is none. */ public static final int NONE = 0; /** * number check. */ public static final int NUMBER = 1; /** * half char check. */ public stat ...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.text.DecimalFormat; import java.text.NumberFormat; import java.text.SimpleDateFormat; import java.util.Calendar; /** * * @author shuai.zhang */ public class MyEclipseCrack { p ...
截取字符串,不允许出现半个的,例如123卡3,截取4位是123 /** * @param args */ public static void main(String[] args) { String info = "1234か5sss"; System.out.println(subString(info, 6)); } public static String subString(String strInfo, int subLength) { if (strInfo == null) { throw n ...
线程传递值: public class TestThread { public static void main(String[] args) { MyThread t = new MyThread(new Work()); t.start(); } } class Data { private int data = 0; public int getData() { return data; } public void setData(int data) { this.data = data; } } ...
1.测试for循环的输出: public class TestOutput { public static void main(String[] args) { int i = 0; for (foo('A'); foo('B') && (i < 3); foo('C')) { i++; foo('D'); } } static boolean foo(char c) { System.out.print(c); return true; } }   输出结果为: ABDCBDCBDCB ...
计算一系列数字有多少个指定字,例如1-12有5个1 public static void main(String[] args) { System.out.println(countNum(120000)); } public static int countNum(int number) { int count = 0; StringBuffer buffer = new StringBuffer(""); for (int i = 1; i <= number; i++) { buffer.append(i ...
输入数字,转换为汉字: /** * @param args */ public static void main(String[] args) { System.out.println(changeNumber(123003098)); } public static String changeNumber(int number) { StringBuffer buffer = new StringBuffer(""); char[] nums = Integer.valueOf(number).toString().to ...
取得一个数组的最大值和次最大值: public static void main(String[] args) { int[] nums = { 2, 3, 4, 1, 2 }; System.out.println(getMax(nums)); System.out.println(getPerMax(nums)); } public static int getMax(int[] nums) { int max = Integer.MIN_VALUE; if (nums == null || nums.length == 0) { t ...
Global site tag (gtag.js) - Google Analytics