import com.sun.jna.platform.win32.Kernel32; import com.sun.jna.platform.win32.User32; import com.sun.jna.platform.win32.WinDef.HMODULE; import com.sun.jna.platform.win32.WinDef.LRESULT; import com.sun
import org.apache.commons.lang.StringUtils; /** * <PRE> * 提供对字符串的全角->半角,半角->全角转换 * </PRE> */ public class BCConvert { /** * ASCII表中可见字符从!开始,偏移位值为33(Decimal) */ static final char DBC_CHAR_START = 33; /
BigDecimal a = new BigDecimal(5); BigDecimal b = new BigDecimal(3); BigDecimal c = a.divide(b, 2, BigDecimal.ROUND_HALF_UP);//四舍五入
/** * @Descriptionmap 将图片文件转化为字节数组字符串,并对其进行Base64编码处理 * @author temdy * @Date 2015-01-26 * @param path 图片路径 * @return */ public static String imageToBase64(String path) {// 将图片文件转化为字节数组字符串,并对其进行Base64
在实际编程中,要尽量避免出现死锁的情况,但是让你故意写一个死锁的程序时似乎也不太简单(有公司会出这样的面试题),以下是一个简单的死锁例子。 线程的同步化可能会造成死锁,死锁发生在两个线程相互持有对方正在等待的东西(实际是两个线程共享的东西)。只要有两个线程和两个对象就可能产生死锁。 /** * 一个简单的死锁类 * 当DeadLock类的对象flag==1时(td1),先锁定o1,睡眠500毫秒
归并排序的时间复杂度是:nlogn 主要是用到二路归并排序,也就是把两个有序集合合并为一个有序集合. 下面是我写的一个递归二路归并排序的算法: public class MergeSort { // private static long sum = 0; /** * <pre> * 二路归并 * 原理:将两个有序表合并和一个有序表 * </pre> * * @param a * @param s
/** * 验证模块,包括输入输出的验证 */ public class Validator { /** * 判断用户输入的时间格式是否正确 */ public static boolean checkDateTime(String inputDate) { String DATE_TIME_FORMAT = "yyyy-MM-dd"; SimpleDateFormat simpleDateFor
/** * @Descriptionmap 将图片文件转化为字节数组字符串,并对其进行Base64编码处理 * @author temdy * @Date 2015-01-26 * @param path 图片路径 * @return */ public static String imageToBase64(String path) {// 将图片文件转化为字节数组字符串,并对其进行Base64
public class BaseAlgorithm { public static void main(String[] args) { int[] arr = { 1, 7, 3, 30, 55, 21, 3, 5, 1, 7, 3 }; System.out.println(findMaxValue(arr)); System.out.println(findMostValue(arr));
/** * 分割字符串 * * @param str String 原始字符串 * @param splitsign String 分隔符 * @return String[] 分割后的字符串数组 */ @SuppressWarnings("unchecked") public static String[] split(String str, String splitsign) { int in
Clipboard clip = Toolkit.getDefaultToolkit().getSystemClipboard(); ImageTransferable imageTrans = new ImageTransferable(bufferImage); clip.setContents(imageTrans, null);
//一种方法是设置全局的代理,在程序中如下设置: System.setProperty("proxySet", "true"); System.setProperty("http.proxyHost", "192.168.7.33"); System.setProperty("http.proxyPort", "8080"); //还有一种就是在发送每次请求的时候设置代理: URL url = n
/** * 验证模块,包括输入输出的验证 */ public class Validator { /** * 判断用户输入的时间格式是否正确 */ public static boolean checkDateTime(String inputDate) { String DATE_TIME_FORMAT = "yyyy-MM-dd"; SimpleDateFormat simpleDateFor
/** * 执行下载 * * @param request * @param response */ protected void doDownload(HttpServletRequest request, HttpServletResponse response) throws Exception { File downloadFile = new File(resourceFullPath)
将图片文件转化为字节数组字符串,并对其进行Base64编码处理 /** * @Descriptionmap 将图片文件转化为字节数组字符串,并对其进行Base64编码处理 * @author temdy * @Date 2015-01-26 * @param path 图片路径 * @return */ public static String imageToBase64(String path)
public boolean isOnline() { ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); return cm.getActiveNetworkInfo().isConnectedOrConnecting(); }
/** * Clicks in a given area of a Swing component. */ public static void doClickInRectangle(Component component, Rectangle rect, boolean useRightClick, Key.Modifier keyModifier) { int modifiers = useR
String content = ""; for(int i=1;i<100;i++)content += i + ") Easy to say, hard to do.\n"; /*1、利用公钥加密至文件*/ { /*1)根据公钥反向构造PublickKey对象,调用cipher的init方法时使用*/ String KEY_PUBLIC = "MFwwDQYJKoZIhvcNAQEBBQADS
List headlist = this.getCS_HEAD(allFactoryNo); HSSFSheet sheet = workbook.createSheet(); sheet.setColumnWidth((short)0, 6000); sheet.setColumnWidth((short)1, 10000); HSSFRow row3 = sheet.createRow(3);
public class MD5 { static final int S11 = 7; static final int S12 = 12; static final int S13 = 17; static final int S14 = 22; static final int S21 = 5; static final int S22 = 9; static final int S23 =