Java snippets01

	for (int i = 0; i < number.length; i++) {
		for (int j = 0; j < number.length - i - 1; j++) {
			if (number[j] < number[j + 1]) {
				int temp = number[j];
				number[j] = number[j + 1];
				number[j + 1] = temp;
			}
		}
	}

BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
String str = buffer.readLine();

Scanner scanner = new Scanner(System.in);
String line = scanner.nextLine();


InputStreamReader in = null;
OutputStreamWriter out = null;
BufferedReader br = null;

in = new InputStreamReader(new FileInputStream(System
					.getProperty("user.dir")
					+ "\\old.txt"), "UTF-8");
br = new BufferedReader(in);
out = new OutputStreamWriter(new FileOutputStream(
					"C:\\WINDOWS\\new.txt"), "UTF-8");

String[] temp;
temp = text.split("\\s{1,}");// 按照空格分割字符串,多个空格作为一个空格对字符串进行分割

String s = String.valueOf(1);
if (s.charAt(i) == '1'){}

System.nanoTime();

		SimpleDateFormat sdt = new SimpleDateFormat("yyyy-MM-DD HH:mm:ss");
		String date = sdt.format(System.currentTimeMillis());

DecimalFormat df = (DecimalFormat) NumberFormat.getInstance();
df.applyPattern("00");

		Calendar current_time = new GregorianCalendar();
		Calendar target_time = new GregorianCalendar(2009, Calendar.MAY, 1);
		long diffMillis = target_time.getTimeInMillis()
				- current_time.getTimeInMillis();
		long diffDays = diffMillis / (24 * 60 * 60 * 1000) + 1;
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-DD");

		System.out.println("距" + sdf.format(target_time.getTimeInMillis())
				+ "还有:" + diffDays + "天");

Arrays.sort(array);

StringBuilder s1 = new StringBuilder(temp);
// StringBuffer s1 = new StringBuffer(temp);
System.out.println(s1.reverse());

你可能感兴趣的:(java,C++,c,windows,J#)