java学习
文章平均质量分 71
天之银月
这个作者很懒,什么都没留下…
展开
-
字节数组转化为16进制字符串输出
近期的一个BLE蓝牙项目要读取硬件发送过来的比特流数据,我们需要将比特流数据线存放到字节数组中,再将字节数组转化为16进制字符串输出。 字节数组转化为16进制字符串输出的程序如下: [java] view plaincopy /** * 方式三 * * @param bytes * @ret原创 2015-08-24 11:13:34 · 2050 阅读 · 0 评论 -
单例模式的多种实现方式
单例模式的多种实现方式原创 2016-03-01 20:41:17 · 6255 阅读 · 1 评论 -
LeetCode----------------------Reverse Words in a String
Given an input string, reverse the string word by word. For example, Given s = "the sky is blue", return "blue is sky the" 程序如下: public class Solution { public String reverseWord原创 2015-09-04 13:45:43 · 372 阅读 · 0 评论 -
java内部类的理解
内部类访问特点: 1,内部类可以直接访问外部类中的成员。 2,外部类要访问内部类,必须建立内部类的对象。 分析事物时,发现该事物描述中还有事物,而且这个事物还在访问被描述事物的内容。这时就是还有的事物定义成内部类来描述。 注意: 1.如果内部类中定义了静态成员,该内部类也必须是静态的。 2.如果内部类是静态的。 相当于一个外部类 为什么内部类能直接访问外部类中成员呢?原创 2015-08-05 15:27:40 · 396 阅读 · 0 评论 -
java异常类
Java中的异常 Exception java.lang.Exception类是Java中所有异常的直接或间接父类。即Exception类是所有异常的根类。 比如程序: public class ExceptionTest { public static void main(String[] args) { int转载 2015-08-05 17:53:01 · 347 阅读 · 0 评论 -
LeetCode--------------Ugly Number
Write a program to check whether a given number is an ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 6, 8 are ugly while 14 is not ugly si原创 2015-09-01 23:51:20 · 437 阅读 · 0 评论 -
leetcode---Factorial Trailing Zeroes
Factorial Trailing Zeroes Given an integer n, return the number of trailing zeroes in n! Note: Your solution should be in logarithmic time complexity. 该题的意思是求n!尾部有多少个0。 分析:1*2*.原创 2015-09-01 15:07:22 · 296 阅读 · 0 评论 -
LeetCode------------------Add Digits
Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has on原创 2015-09-02 14:08:10 · 295 阅读 · 0 评论 -
LeetCode---------------Sort Colors
Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue. Here, we will use the integers原创 2015-09-02 11:24:32 · 309 阅读 · 0 评论 -
leetcode--------------Length of Last Word
Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string. If the last word does not exist, return 0. Note: A word is原创 2015-09-01 23:19:48 · 293 阅读 · 0 评论 -
java多态的理解
/* 多态时, 成员的特点: 1,成员变量。 编译时:参考引用型变量所属的类中的是否有调用的成员变量,有,编译通过,没有,编译失败。 运行时:参考引用型变量所属的类中的是否有调用的成员变量,并运行该所属类中的成员变量。 简单说:编译和运行都参考等号的左边。哦了。 作为了解。 2,成员函数(非静态)。 编译时:参考引用型变量所属的类中的是否有调用的函数。有,编译通过,没有,编译原创 2015-08-05 14:55:46 · 322 阅读 · 0 评论 -
java中静态方法和实例方法的区别
静态方法和实例方法的区别 在外部调用静态方法时,可以使用"类名.方法名"的方式,也可以使用"对象名.方法名"的方式。而实例方法只有后面这种方式。也就是说,调用静态方法可以无需创建对象。静态方法在访问本类的成员时,只允许访问静态成员(即静态成员变量和静态方法),而不允许访问实例成员变量和实例方法;实例方法则无此限制。 之所以不允许静态方法访问实例成员变量,是因为实例成员变量原创 2015-07-23 16:33:05 · 1325 阅读 · 0 评论 -
javaWeb 实现文件下载的功能
javaWeb 实现文件下载的功能原创 2016-03-02 17:14:47 · 457 阅读 · 0 评论