public static void main(String[] args) { int i, n[] = { (((1 << 1) << (1 << 1) << (1 << 1) << (1 << (1 >> 1))) + ((1 << 1) << (1 << 1))), (((1 << 1) << (1 << 1) << (1 << 1) << (1 << 1)) - ((1 Read More
posted @ 2013-06-20 10:38 带狗狗带 Views(282) Comments(0) Diggs(0) Edit
首先,Point类public class Point { int x, y; public Point(int x, int y) { this.x = x; this.y = y; } boolean isSame() { return x == y; }}测试代码A:public class RandomTest { public static Random random = new Random(); public static void main(String[] args) { int... Read More
posted @ 2013-06-20 10:20 带狗狗带 Views(610) Comments(0) Diggs(0) Edit
程序命名(针对那些不能混淆的代码)容易输入的名字。比如:Fred,asdf单字母的变量名。比如:a,b,c, x,y,z,或者干脆上中文比如(阿隆索肯德基)有创意地拼写错误。比如:SetPintleOpening, SetPintalClosing。这样可以让人很难搜索代码。抽象。比如:ProcessData, DoIt, GetData… 抽象到就跟什么都没说一样。缩写。比如:WTF,RTFSC …… 使用拼音缩写也同样给力,比如: BT,TMD,TJJTDS随机大写字母。比如:gEtnuMbER..重用命名。在内嵌的语句块中使用相同的变量名有奇效。使用重音字母或者其他奇葩字符。比如:int Read More
posted @ 2013-06-20 09:48 带狗狗带 Views(401) Comments(0) Diggs(0) Edit
欢迎提出建议指出错误互相交流。1.统计对象数量,比如统计一共发射了多少颗子弹。 public class Bullet { public static int count = 0; public Bullet() { count++; }}2.判断一个浮点数小数位有没有值。public boolean isInt(float f) { return f == (int) f; }3.聪明你的一定想到了,获取一个浮点数的小数部分public static float getZeroPoint(float f) { retur... Read More
posted @ 2013-06-20 09:18 带狗狗带 Views(199) Comments(0) Diggs(0) Edit