java实现产生固定时间段里面的随机日期public class test{ public static void main(String[] args) { Date randomDate = randomDate("2012-06-01", "2012-12-12&……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2233浏览 797个赞
用javaCC实现double型数据的加减乘除法,正弦、余弦、正切、余切、反正弦、反余弦、反正切、反余/** * JavaCC file */ options { JDK_VERSION = "1.5";}PARSER_BEGIN(computer)package com.zju.edu;import java.……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2292浏览 688个赞
java批量将gbk的乱码文件转换到utf8package com.iteye.niewj.util;import java.io.BufferedReader;import java.io.File;import java.io.FileInputStream;import java.io.FileOutputStream;import j……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2472浏览 1858个赞
Java 遍历Map的同时时删除指定元素package net.nie.test;import java.util.HashMap;import java.util.Iterator;import java.util.Map;public class HashMapTest { private static Map<Integer……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2091浏览 512个赞
下文代码中,除了指定rootlogger输出到控制台和文件logdemo.log中之外,还定义了一个指定目的的子logger,令其日志输出到logdemo2.log文件中,同时它不继承rootlogger的输出特性。来源:http://blog.csdn.net/dongzi87/article/details/8292865 ……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2712浏览 530个赞
子线程循环10次,接着主线程循环100次,接着回到子线程循环10次,接着再回到主线程循环100次,如此循环50次package com.jb.liang;public class TraditionalThread3 { /** * 互斥,上锁都是放在待操作的资源的类的内部方法中,而不是线程代码中 * @author jiall * 子……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1424浏览 2588个赞
java PDF文件解析成Stringboolean sort = false;// 是否排序int startPage = 1;// 开始提取页数int endPage = Integer.MAX_VALUE;// 结束提取页数Writer output = null;// 文件输入流,生成文本文件PDDocument document = ……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1915浏览 1683个赞
java非递归检索文件夹下所有文件DateFormat df = DateFormat.getDateTimeInstance();LinkedList<File> folders = new LinkedList<File>();LinkedList<File> filelists = new LinkedLi……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1936浏览 2137个赞
Java对json是否合法进行格式校验/** * 用于校验一个字符串是否是合法的JSON格式 * */import java.text.CharacterIterator;import java.text.StringCharacterIterator;public class JsonValidator { private Ch……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1770浏览 1392个赞
java对properties文件进行解析,在用java自带的properties类进行properties文件解析的时候,输出的时候很可能出现乱码问题,在开始的时候我也是找不到问题,查出了之后,贴出来跟大家分享。作者:xulong1516519package properties;import java.io.File;import java.i……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2591浏览 587个赞
Java DOC 转换给 PDF 格式文档import java.io.File;import java.net.ConnectException;import java.util.Date;import com.artofsolving.jodconverter.DocumentConverter;import com.artofsolvin……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1259浏览 208个赞
可以用于有向图和无向图。用负数表示该有向路不通。在EditPlus上写的,所以就一个.java文件。package Test;import java.util.TreeMap;import java.util.ArrayList;import java.io.BufferedReader;import java.io.InputStreamRe……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2000浏览 2527个赞
Java读写二进制文件import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; impor……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2844浏览 2472个赞
Java查找目录下的及子目录下的指定扩展名的文件package FileDemo;import java.io.BufferedWriter;import java.io.File;import java.io.FileWriter;import java.io.FilenameFilter;import java.io.IOExceptio……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1261浏览 562个赞
java操作XML中的占位符 有时XML的某些内容是待定的,对于这些内容可以在XML文件中使用占位符<people> <person id="001"> <name>$name</name> ……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2263浏览 256个赞
java在web端直接输出Excel实现下载public String excelDomnload() throws Exception{ try{ /* String path = GlobalKeys.getFunctionConfig("user_attach_save","/opt/tmp/&qu……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1603浏览 1584个赞
Java实现的字符型进度条package com.gondi.util;/** * 显示进度条(参数:当前点、结束点、进度条长度) * example: * System.out.println(ProgressBar.showBarByPoint(30, 100, 20)); * result: * [-----> ……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2055浏览 2110个赞
Java读取Html文本解析email地址的代码代码来自:http://blog.csdn.net/javaalpha/article/details/8332587package com.alpha.test;import java.io.BufferedReader;import java.io.File;import java.io.File……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1682浏览 2655个赞
Java获取系统当前时间的方法并指定格式/** * 返回当前日期时间字符串<br> * 默认格式:yyyy-mm-dd hh:mm:ss * * @return String 返回当前字符串型日期时间 */ public static String getCurrentTime() { String return……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2919浏览 853个赞
创建ZIP和JAR文件import java.util.zip.*;import java.io.*;public class ZipIt {public static void main(String args[]) throws IOException {if (args.length < 2) {System.err.prin……继续阅读 » 水墨上仙 4年前 (2021-04-07) 3110浏览 1215个赞
java发送邮件import javax.mail.*;import javax.mail.internet.*;import java.util.*;public void postMail( String recipients[ ], String subject, String message , String from) throws……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2499浏览 1573个赞
发送代数据的HTTP 请求import java.io.BufferedReader;import java.io.InputStreamReader;import java.net.URL;public class Main {public static void main(String[] args) {try {URL my_ur……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1457浏览 2187个赞
把 Array 转换成 Mapimport java.util.Map;import org.apache.commons.lang.ArrayUtils;public class Main {public static void main(String[] args) {String[ ][ ] countries = { { &quo……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1691浏览 2125个赞
Java正则表达式提取 Email 地址import java.util.regex.Matcher;import java.util.regex.Pattern;import java.io.BufferedReader;import java.io.File;import java.io.FileReader;import java.io……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1237浏览 1860个赞
Java中,通常有两种遍历HashMap的方法,大家可以参考一下:转自:http://blog.csdn.net/newcnzz/article/details/8434631import java.util.*; public class MapTest { static HashMap<String, Integer> ……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2462浏览 1602个赞
Java中创建与启动线程(Threading)的代码演示转自:http://java.chinaitlab.com/line/373702.htmlpublic class MyThread_1 extends Thread{public void run(){//some code }} ……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1739浏览 574个赞
Java实现简单的鼠标划线import javax.swing.JFrame;import javax.swing.JPanel;import java.awt.Graphics;import java.awt.event.MouseListener;import java.awt.event.MouseMotionListener;impo……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1955浏览 2346个赞
java实现的二分查找法static public int search(int [] array, int target){ int high = array.length, low = -1, probe; while (high - low > 1) { probe = (low + high) &……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1654浏览 1211个赞
java代码将时间从sourceTZ时区转换成targetTZ时区/* * Converts time from sourceTZ TimeZone to destTZ TimeZone. * * @return converted time, or the original time, in case the datetime c……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2726浏览 374个赞
Java运行时获得参数类型class A<T> { Class<T> specializedClass; public A() { this.specializedClass = (Class<T>) ((ParameterizedType) this.getClass() ……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2946浏览 410个赞
Java创建二叉树并遍历的代码来源:http://blog.csdn.net/yhhazr/article/details/7944089public class BinaryTree { private Node root; /** * * 内部节点类 * @author yhh */ private class Node……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1515浏览 464个赞
解析class的工具类package com.google.reflect;import java.lang.reflect.Field;import java.lang.reflect.Method;import java.lang.reflect.Modifier;import java.lang.reflect.Proxy;impo……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2996浏览 2743个赞
java 文件夹操作import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.nio.ByteBuffer; import java.ni……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2498浏览 299个赞
java生成pdf package com.hundsun.gildata.irp.core.action;import java.io.File;import java.io.FileOutputStream;import java.io.IOException;import com.hundsun.gildata.irp.common.……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2171浏览 1164个赞
Java模拟队列的出队和进队 package com.stackANDqueue;import java.io.DataInputStream;import java.io.IOException;/* * 循环队列的入队和出队 */public class Queue { static int MAX = 20; static ……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2416浏览 2363个赞
—–初试阿里云平台——目录—–初试阿里云平台——一、什么是阿里云平台与阿里云Serverless技术二、日常部署三、个人心得一、什么是阿里云平台与阿里云Serverless技术云开发平台是面向开发者打造的一站式、全云端的开发平台,打开浏览器就可以开发、调试、上线,……继续阅读 » Thomas_one 4年前 (2021-04-07) 1861浏览 0评论2042个赞
JS代码时间格式与时间戳的相互转换 一.时间转换时间戳function transdate(endTime){var date=new Date();date.setFullYear(endTime.substring(0,4));date.setMonth(endTime……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2246浏览 596个赞
JavaScript添加到收藏夹和设置为主页的代码,网站上经常用到的两个功能// JavaScript Document// 加入收藏 < a onclick="AddFavorite(window.location,document.title)" >加入收藏< /a>function AddFav……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1765浏览 2963个赞
JavaScript SHA512加密算法详细代码/* * A JavaScript implementation of the Secure Hash Algorithm, SHA-512, as defined * in FIPS 180-2 * Version 2.2 Copyright Anonymous Contributor, Pau……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1936浏览 2246个赞
JavaScript SHA-256加密算法详细代码/* * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined * in FIPS 180-2 * Version 2.2 Copyright Angel Marin, Paul Johnsto……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2235浏览 114个赞
JavaScript SHA1加密算法实现详细代码/* * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined * in FIPS 180-1 * Version 2.2 Copyright Paul Johnston 2000 - 2009. ……继续阅读 » 水墨上仙 4年前 (2021-04-07) 3157浏览 1634个赞
当鼠标在图片上方时,图片停止漂浮,点击关闭按钮可隐藏图片,代码简单,直接插入网页更换成自己的漂浮图片就可以使用。<body><div id="float" style=" position:absolute; z-index:3"><img id="img1"……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2283浏览 823个赞
JavaScript检测浏览器cookie是否已经启动,代码稍显复杂,通过写入一个测试cookie判断cookie是否已经启动var dt = new Date(); dt.setSeconds(dt.getSeconds() + 60); document.cookie = "cookietest=1; expires=" +……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1843浏览 660个赞
在一个网页中同时调用jQuery和prototype会产生冲突,主要是$全局变量冲突,下面这段代码有效的解决了这个问题一定要先引入prototype.js 再引入jquery.js,先后顺序不可错<script src="prototype.js"></script><script src=&quo……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2248浏览 550个赞
要从列表框同时删除多个项目,我们不能从上到下的删除,因为上面的项目每删除一个,下面的项目的索引号就会变化,所以只能从下向上删除,这样就不会出现索引号乱变的问题了。 html代码<table><tr> <td align="cent……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2545浏览 2053个赞