java知识总结
veeson1024
这个作者很懒,什么都没留下…
展开
-
java中enum的使用示例
enum在Java和Android开发中都较为常用,比如下面的举例:public enum Week { SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY }编写测试类public class TestEnum { public static void main(String[] args) {原创 2016-09-25 16:52:06 · 332 阅读 · 0 评论 -
java byte数组打印
十六位数组打印输出简单的方式Byte[] bs = {0x0F, 0x1F, 0x2F, 0x3F, 0x4F, 0x5F, 0x6F};System.out.println(Arrays.toString(bs)); 打印输出结果[15, 31, 47, 63, 79, 95, 111]更加通用一点的方式byte[] bs = hexStringToByteArray("e04fd原创 2017-08-22 11:41:55 · 101933 阅读 · 2 评论 -
Android 写入文件(不覆盖原来的文件)
添加权限<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />示例 public static void writeLog(String message) { File myDir = new File(Environment.getExternalStorageDirect原创 2017-09-13 10:34:53 · 4046 阅读 · 0 评论 -
Java写的保持socket长连接客户端代码
public class Client { private Socket socket = null; private OutputStream os = null; private InputStream is = null; public static void main(String[] args) { new Client().new So...原创 2017-10-12 15:09:37 · 21036 阅读 · 2 评论