小程序生成二维码(带参数) import java.io.BufferedReader;import java.io.File;import java.io.FileNotFoundException;import java.io.FileOutputStream;import java.io.IOException;import java.io.InputStream;import java.io.InputStreamReader;import java.net.URL;import java.net.URLC..
汉字转拼音(完美解决多音字) <dependency> <groupId>com.belerweb</groupId> <artifactId>pinyin4j</artifactId> <version>2.5.1</version></dependency>package com.tele.utils;import net.sourceforge.pinyin4j.PinyinHelper;i.
IP地址与数字互转 java 一、将IP地址转为long数值将IP地址转化成整数的方法如下:1、通过String的split方法按.分隔得到4个长度的数组。2、通过左移位操作(<<)给每一段的数字加权,第一段的权为2的24次方,第二段的权为2的16次方,第三段的权为2的8次方,最后一段的权为1。 //方法一 用左移、按位或实现、效率更高 public long ipToLong1(String ipAddress) { long result = 0; Stri
自定义注解防止表单重复提交 import java.lang.annotation.Documented;import java.lang.annotation.ElementType;import java.lang.annotation.Inherited;import java.lang.annotation.Retention;import java.lang.annotation.RetentionPolicy;import java.lang.annotation.Target;/** * 自定义注解防止.
RSA加密和解密工具 /** * RSA加密和解密工具 */public class RSAUtil { /** * 数字签名,密钥算法 */ private static final String RSA_KEY_ALGORITHM = "RSA"; /** * 数字签名签名/验证算法 */ private static final String SIGNATURE_ALGORITHM = "MD5withRSA"; /** .
java 密码安全策略,杜绝弱口令 /** * @description: 密码安全策略,杜绝弱口令 */public class PwdCheckUtil { // 斜向连续键盘数字 public static String[] KEYBOARD_SLOPE_ARR = { "!qaz", "1qaz", "@wsx", "2wsx", "#edc", "3edc", "$rfv", "4rfv", "%tgb", "5tgb", "^yhn", "6yhn", "&a.
java精确的浮点数运算 import java.math.BigDecimal;import java.math.RoundingMode;/** * 精确的浮点数运算 */public class Arith { /** * 默认除法运算精度 */ private static final int DEF_DIV_SCALE = 10; /** * 这个类不能实例化 */ private Arith() { } /** .
java获取IP方法工具类 import org.apache.commons.lang3.StringUtils;import java.net.InetAddress;import java.net.UnknownHostException;import javax.servlet.http.HttpServletRequest;/** * 获取IP方法 * * @author wnkj */public class IpUtils { public static String getIpAddr(.