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

📄 datamanager.java

📁 是个swing 写的好的通信程序,里面有数据库和原码,运行就可以了,希望好好的
💻 JAVA
字号:
package smoker.tools;

import java.io.*;
import java.security.*;
import sun.misc.BASE64Encoder;

public class DataManager {

	public static boolean isNumeric(String str) {
		if (str.trim().length() == 0) {
			return false;
		}
		for (int i = 0; i < str.length(); i++) {
			char c = str.charAt(i);
			if (!Character.isDigit(c)) {
				return false;
			}
		}
		return true;
	}

	public static boolean isLegitimacyIP(String strIP) {
		int ptionCount = 0;
		if (strIP.trim().length() < 7 || strIP.trim().length() > 15) {
			return false;
		}
		for (int i = 0; i < strIP.length(); i++) {
			char c = strIP.charAt(i);
			if (c == '.') {
				ptionCount++;
				continue;
			} else if (!Character.isDigit(c)) {
				return false;
			}
		}
		if (ptionCount != 3) {
			return false;
		}
		String tempIP = strIP.replace('.', ';');
		String[] ip = tempIP.split(";");
		for (int i = 0; i < ip.length; i++) {
			if (Integer.parseInt(ip[i]) > 255) {
				return false;
			}
		}
		return true;
	}

	public String EncoderByMd5(String password) {
		String md5Password = null;
		try {
			MessageDigest md5 = MessageDigest.getInstance("MD5");
			BASE64Encoder base64en = new BASE64Encoder();
			md5Password = base64en.encode(md5
					.digest(password.getBytes("utf-8")));
		} catch (NoSuchAlgorithmException e) {
			e.printStackTrace();
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}
		return md5Password;
	}

	public static boolean isDate(String date) {
		return true;
	}

	public static boolean isEmail(String email) {
		return true;
	}
}

⌨️ 快捷键说明

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