A linked list consists of a series of structures, which are not necessarily adjacent in memory. We assume that each structure contains an integer key and a Next pointer to the next structure. Now give...
分类:
其他好文 时间:
2015-03-06 15:58:03
阅读次数:
163
Determine whether an integer is a palindrome. Do this without extra space. click to show spoilers.
Some hints: Could negative integers be palindromes?...
分类:
其他好文 时间:
2015-03-06 14:14:56
阅读次数:
111
android studio默认支持单元测试,相对于Eclipse要方便一些。
新建完一个项目之后你会发现同时生成了一个ApplicationTest类,如图:
同样,假设已经实现了一个计算百分比功能需要测试,代码:public class ProgressService {
public Integer getCurrentProgerss(double curren...
分类:
移动开发 时间:
2015-03-06 12:46:18
阅读次数:
146
假设已经实现了一个计算百分比功能需要测试,代码:
public class ProgressService {
public Integer getCurrentProgerss(double current, double max) {
Integer i=(int)((current / max) * 100) ;
return i;
}
}...
分类:
移动开发 时间:
2015-03-06 12:46:03
阅读次数:
124
*******************************************************************目的:定义一个整型数据原型:Integer varName[(subscripts)],varName[(subscripts)],........... 解释:I....
分类:
其他好文 时间:
2015-03-06 12:40:52
阅读次数:
104
将一个整数颠倒 基本思路:用一个标志位记录整数的符号,如果是负数转换成整数后颠倒,然后再乘以-1。本题主要考虑的是溢出。 注意点: 负数到正数的过程中存在溢出 数字颠倒后存在溢出 class Solution {public: int reverse(int x) { long long res =...
分类:
其他好文 时间:
2015-03-06 09:54:24
阅读次数:
150
Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below ...
分类:
其他好文 时间:
2015-03-05 20:48:00
阅读次数:
156
JDK 5发布之前,使用包装类对象进行运算时,需要较为繁琐的“拆箱”和“装箱‘操作
装箱
Interger i=integer.valueOf(100);
Interger j=integer.valueOf(200);
拆箱+装箱:
Integer k=Interger.valueOf(i.intValue() + j.intValue());
JDK 5增加了自动拆箱和装箱功能,列入
Interger i=100;Interger j=200;
Interger k=i+j;...
分类:
编程语言 时间:
2015-03-05 19:35:15
阅读次数:
137
Gson是一个超好用的json-对象相互转换的工具。如果您还没有,可以到这里去下载gson2.2.2.jar
首先准备两个类,如下:
public class One {
int integer = 10;
String a = null;
Two comTwo = new Two();
@Override
public String toString() ...
分类:
其他好文 时间:
2015-03-05 19:28:13
阅读次数:
167
/** TreeSet存储对象的时候, 可以排序, 但是需要指定排序的算法** Integer能排序(有默认顺序), String能排序(有默认顺序), 自定义的类存储的时候出现异常(没有顺序)** 如果想把自定义类的对象存入TreeSet进行排序, 那么必须实现Comparable接口* 在类上i...
分类:
其他好文 时间:
2015-03-05 19:18:54
阅读次数:
146