Hidden Gems in the Java APIs - Utility Classes and Methods
来源:互联网 发布:淘宝客怎么开始推广 编辑:程序博客网 时间:2024/04/30 13:13
net.rim.device.api.synchronization.UIDGenerator
线程安全的,生成32-bit或64-bit唯一标识。
IOUtilities.streamToBytes()方法把输入流直接转换为byte[]
public static byte[] toByteArray(InputStream in) throws
IOException {
return IOUtilities.streamToBytes(in);
}
net.rim.device.api.util.StringUtilities
stringToWords() stringToKeywords():英语单词分词
toLowerCase() and toUpperCase():大小写转换
compareToIgnoreCase():不区分大小写比较
net.rim.device.api.util.DateTimeUtilities
代码:
public static final long SEC_PER_MIN = 60L;
public static final long SEC_PER_HOUR = SEC_PER_MIN * 60L;
public static final long SEC_PER_DAY = SEC_PER_HOUR * 24L;
public static void formatElapsedTimeDemo() {
long[] times = {
0,
1,
(SEC_PER_MIN * 20) + 20,
(SEC_PER_DAY * 30) + (SEC_PER_HOUR * 5) + (SEC_PER_MIN * 44) + 3
};
StringBuffer sb = new StringBuffer();
for (int i = 0; i < times.length; i++) {
long time = times[i];
DateTimeUtilities.formatElapsedTime(times[i], sb, true);
System.out.println(time + " -> " + sb);
}
}
结果:
0 -> 0:00
1 -> 0:01
1220 -> 20:20
2612643 -> 30:05:44:03
30天5小时44分钟03秒
- Hidden Gems in the Java APIs - Utility Classes and Methods
- Java-Abstract classes and methods
- The Default Methods And Static Methods In Java Interface
- Xcode Search: the Hidden Gems
- Partial Classes and Methods
- Classes, Methods and RTTI
- Classes, Objects, and Methods
- WORDPRESS HIDDEN GEMS: CHECKED(), SELECTED(), AND DISABLED()
- About Abstract Methods and Classes
- Top 16 Java Utility Classes
- Accessing hidden System Service APIs in Android
- Kernel APIs Timers and lists in the 2.6 kernel
- Threads and Anonymous Classes in JAVA
- Utility Classes
- Inner classes in Java, the mystery within.
- Java utility methods-- to process date.
- EventBusException: Subscriber class *** and its super classes have no public methods with the @Subsc
- EventBusException: Subscriber class *** and its super classes have no public methods with the @Subsc
- 在eclipse使用tomcat调试
- CSV TXT
- 让 .Net 程序 脱离 .net framework框架 运行的方法
- maven安装
- 献给正在郁闷的人们
- Hidden Gems in the Java APIs - Utility Classes and Methods
- C# 开发的中文搜索引擎源代码
- 缺钱
- 硪_永远也不要成为,沵幸福的阻力.
- android平台上px和dip的关系理解
- 黑莓浏览器通过BES服务器访问Tomcat服务器上的Word文档,报错,不支持的媒体类型:application/vnd.ms-wsworld
- SqlServer插入慢的问题解决
- xml相关知识
- android在apk中引入第三方jar