小凉

3 0642700 3 0642770 5 34202 13942 4314 0624

2016年5月19日

java 文件压缩和解压(ZipInputStream, ZipOutputStream)

摘要: 最近在看java se 的IO 部分 , 看到 java 的文件的压缩和解压比较有意思,主要用到了两个IO流-ZipInputStream, ZipOutputStream,不仅可以对文件进行压缩,还可以对文件夹进行压缩和解压。 ZipInputStream位于java.util.zip包下。下面是 阅读全文

posted @ 2016-05-19 16:01 小凉 阅读(41008) 评论(3) 推荐(1) 编辑

2016年5月12日

HeadFirst 设计模式

摘要: 一、设计原则 封装变化 多用组合,少用继承 针对接口编程,不针对实现编程 为交互对象之间的松紧耦合设计而努力 对扩展开放,都修稿关闭 依赖抽象,不要依赖具体类 最少知识原则:之和朋友交谈 好莱坞原则:别找我,我会找你(由超类主控一切,当他们需要的时候,自然回去调用子类) 类应该只有一个改变的理由 二 阅读全文

posted @ 2016-05-12 20:42 小凉 阅读(382) 评论(0) 推荐(0) 编辑

Number of 1 Bits(Difficulty: Easy)

摘要: 题目: Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight). For example, the 32- 阅读全文

posted @ 2016-05-12 18:20 小凉 阅读(147) 评论(0) 推荐(0) 编辑

2016年5月10日

Longest Substring Without Repeating Characters(Difficulty: Medium)

摘要: 题目: Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which the 阅读全文

posted @ 2016-05-10 20:36 小凉 阅读(126) 评论(0) 推荐(0) 编辑

2016年5月9日

Counting Bits(Difficulty: Medium)

摘要: 题目: Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation a 阅读全文

posted @ 2016-05-09 17:30 小凉 阅读(127) 评论(0) 推荐(0) 编辑

2016年5月6日

Power of Four(Difficulty: Easy)

摘要: 题目: Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example:Given num = 16, return true. Given num = 5, retur 阅读全文

posted @ 2016-05-06 17:40 小凉 阅读(204) 评论(0) 推荐(0) 编辑

2016年5月5日

Integer Break(Difficulty: Easy)

摘要: 题目: Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum 阅读全文

posted @ 2016-05-05 18:18 小凉 阅读(173) 评论(0) 推荐(0) 编辑

字符串旋转

摘要: 题目:Reverse String (难度一颗星) Write a function that takes a string as input and returns the string reversed.Example:Given s = "hello", return "olleh". 实现: 阅读全文

posted @ 2016-05-05 16:33 小凉 阅读(194) 评论(0) 推荐(0) 编辑

2016年4月14日

并发编程初探-对象的组合

摘要: 对象的组合 一、设计线程安全的类 1.在设计线程安全类的过程中,需要包括以下三个基本要素: 1)找出构成对象状态的所有变量 2)找出约束状态变量的不变性条件 3)建立对象状态的并发访问管理策略 2.收集同步需求 要确保类的线程安全性,就需要确保它的不变性条件不会再并发访问的情况下被破坏,这就需要对其 阅读全文

posted @ 2016-04-14 23:52 小凉 阅读(313) 评论(0) 推荐(0) 编辑

并发编程初探-对象的共享

摘要: 对象的共享 一、可见性 在没有同步的情况下,编译器以及运行时等收可能对操作的执行顺序进行一些意想不到的调整,在缺乏足够同步的多线程程序中,要想对内存操作的执行顺序进行判断,几乎无法得到正确的结论。 1.缺乏同步的程序中可能出产生错误结果的一种情况:失效数据 2.非原子操作 当线程在没有同的情况下读取 阅读全文

posted @ 2016-04-14 12:35 小凉 阅读(667) 评论(0) 推荐(0) 编辑

导航