⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 helper.java

📁 是一款国外的网络游戏平台的源码*不是类似浩方那种虚拟局域网技术
💻 JAVA
字号:
/*
 * Created on Jun 11, 2005
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package org.GTADS.helper;

import java.util.Date;

/**
 * @author Administrator
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class Helper {
	public static boolean server;
	
	public static void setAsServer(boolean b){
		server = b;
	}
	
	public static boolean isServer() {
		return server;
	}
	
	public static String clipCarriageReturn(String s) {
		if (s.length() >= 3) {
			if (s.endsWith("\r\n")) {
				s = s.substring(0,s.length() - 2);
				return s;
			}
		}
		return s;
	}
	
	public static String formatSingleTimeDigit(int numeral){
		String correctedDigit = new String(numeral + "");
		if (numeral >= 0 && numeral < 10)
			correctedDigit = "0" + numeral;
		return correctedDigit;
	}
	
	public static String getDate(boolean is24Hour) {
		String zero = "0";
		Date currentTime = new Date();
		int currentHour = currentTime.getHours();
		int currentMinute = currentTime.getMinutes();
		int currentSecond = currentTime.getSeconds();
		
		if (!is24Hour){
			if (currentHour > 12) {
				currentHour -= 12;
			}
			if (currentHour == 0){
				currentHour = 12;
			}
		}
		
		String hour = Helper.formatSingleTimeDigit(currentHour);
		String minute = Helper.formatSingleTimeDigit(currentMinute);
		String seconds = Helper.formatSingleTimeDigit(currentSecond);
		
		return hour + ":" + minute + ":" + seconds;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -