import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class Md5Util {
private static final char HEX_DIGITS[] = { '0', '1', '2', '3', '4', '5',
'6', '7', '8',...
分类:
编程语言 时间:
2015-01-19 14:29:16
阅读次数:
202
1.创建文件夹 private static final String PATH = "hdfs://hadoop:9000/"; private static final String DIR = "/d2"; public static void main(String...
分类:
其他好文 时间:
2015-01-19 00:12:26
阅读次数:
263
需求:
输入:File对象输出:String对象(MIMEl类型)
实现步骤:
1. 获得获取文件的扩展名
private static String getExtension(final File file) {
String suffix = "";
String name = file.getName();
final int idx = name.lastIn...
分类:
移动开发 时间:
2015-01-17 22:16:54
阅读次数:
252
temppos:记录子字符串开始的下标
list:存放重复的子字符串
public class RepeatString {
private static void longestdupString(String s) {
if (s == null || s.length() == 0) {
return;
}
char temp = s.charAt(0);
...
分类:
其他好文 时间:
2015-01-17 13:57:37
阅读次数:
106
Android手机话筒采样有部分代码是在网上找的,具体不记得了。
使用采样结果以及是自己的app的功能代码:
1. 在一部分app中会需要对话筒的音频输入获取使用,比如之前很火的吹裙子;
2. 采样线程:
public class MicroLevelRunnable implements Runnable {
private static final String tag = "Mi...
分类:
移动开发 时间:
2015-01-16 19:14:54
阅读次数:
189
/// /// html转换为纯文本 /// /// /// private static string HtmlToPlainText(string source) { string...
分类:
Web程序 时间:
2015-01-16 14:22:53
阅读次数:
190
防止按钮连续点击其实实现很简单 共通方法public class Utils { private static long lastClickTime; public static boolean isFastDoubleClick() { long time = Syste...
分类:
移动开发 时间:
2015-01-16 12:38:15
阅读次数:
131
单例模式保证每个类只有一个实例,并提供一个全局访问点第一步 构造方法私有化第二步 公有化静态方法获取的实例懒汉式public class Bank{ private Bank(){} private static Bank bank = null; public static Ba...
分类:
其他好文 时间:
2015-01-15 19:50:02
阅读次数:
148
Double-checked Locking (DCL)用来在lazy initialisation 的单例模式中避免同步开销的一个方法。
下面是这么做的一个例子。
[java] view
plaincopy
public class MyFactory {
private static MyFactory instance;...
分类:
编程语言 时间:
2015-01-15 16:05:22
阅读次数:
297
无需过多说明的单例模式
public class LazySingleton {
private static class LazyLoading {
// static Context context;
private static LazySingleton instance = new LazySingleton() {
...
分类:
编程语言 时间:
2015-01-15 15:58:51
阅读次数:
190