java中System方法

package test;


import java.util.*;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.locks.Lock;

import javax.print.attribute.IntegerSyntax;

import org.omg.CosNaming.NamingContextExtPackage.AddressHelper;

import privateclass.*;
import java.io.*;

public class Main {

	private static final String space_operator = " ";
	public static void main(String[] args) throws Exception {

		Scanner scanner = new Scanner(new BufferedInputStream(System.in));
		//PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
		
		TreeMap<Character,Integer> hashMap = new TreeMap<Character,Integer>();
		
		long time1 = System.currentTimeMillis();
		String string = "dsddd --gdfg  dbx sdz";
		for (int i = 0; i < string.length(); i++) {
			Integer valueInteger = hashMap.get(string.charAt(i));
			if(!Character.isAlphabetic(string.charAt(i)))continue;
			
			int count = 1;
			if(valueInteger != null)
			{
				count = valueInteger + 1;
			}
			hashMap.put(string.charAt(i), count);

		}
		
	
		
		System.out.println(hashMap);
		
		//获取时间   时间是距离1970年的时间
		long time2 = System.currentTimeMillis();
		
		
		System.out.println(time2 - time1);
		
		/*
		 * 获取系统信息
		 */
		/*
		Properties mes = System.getProperties();
		for(Object name : mes.keySet())
		{
			System.out.println(name + "::" + mes.getProperty((String) name));
		}
		*/
		
		/*
		 * 拿到系统所用的换行符号直接换行,针对不一样的系统
		 */
		final String LINE_SEPARATOR = System.getProperty("line.separator");
		System.out.println("hello" + LINE_SEPARATOR + "word");
		
		
		/*
		 * 可以自己设置系统属性
		 */
		System.setProperty("myclass", "tiantian");
		
	}
	
}

  

猜你喜欢

转载自www.cnblogs.com/WINDZLY/p/11788708.html
今日推荐