- 浏览: 96377 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (48)
- ruby (7)
- scala (1)
- java (11)
- jython (1)
- python (1)
- life (0)
- jruby (1)
- javascript (1)
- 翻译 (0)
- lua (2)
- SUSE (1)
- scheme (6)
- amb (1)
- 编译器 (0)
- javaee (1)
- 分布式 (0)
- 并发 (1)
- 杂感 (1)
- IO (0)
- POJO (0)
- EJB (0)
- concurrent (0)
- 算法 (1)
- ibm (0)
- JNI (0)
- AOP (0)
- asm (0)
- Groovy (1)
- agent (0)
- instrument (0)
- manifest (1)
- classloader (0)
- jboss (0)
- code (0)
- OSGI (0)
- 庄子 (0)
- JTA (0)
- SA (1)
- clojure (0)
- collections (0)
- hotswap (0)
- 序列化 (0)
- CORS (0)
- 停机 (0)
- JVM (0)
- parallel (0)
- NIO (0)
- weblogic (0)
- transaction (1)
- 反思 (1)
- 事务 (1)
- 海量数据 (0)
- JDO (0)
- JPA (0)
- storm (0)
- log4j (0)
- java2d (0)
- btrace (0)
- hadoop (1)
- cygwin (1)
- sshd (1)
- wanlu (0)
- mysql (0)
- debug (0)
- autotest (0)
- Error (0)
- 数据结构 (0)
- descriptor (0)
- jdb (0)
- hsdb (0)
- wiki (0)
- maven (0)
- spring (0)
- eclipse (0)
- mvc (0)
- 代理 (0)
- oracle (0)
- hibernate (1)
- Hash (0)
- blockingqueue (0)
- remember (0)
- graphviz (0)
- http (0)
- post (0)
- jdbc (0)
- websocket (0)
- inter (0)
- got error: The Network Adapter could not establish the connection when creating a data source in Weblogic pointing to a Oracle database (1)
- bug (0)
- xml (0)
- mail (0)
- db (0)
- JAXB (0)
- StAX (0)
- google (0)
- haskell (1)
- rpc (0)
- read-code (0)
- spring-cloud (0)
- service-registry-discovery (0)
最新评论
-
IamSungod:
很有探索精神,学过多种编程语言呀
clojure parse xml -
messi_18:
是的。不知道别的平台是否也有类似问题。
scalatest 尝试(一) -
llh110220:
lz在windows下编写的吧
scalatest 尝试(一)
相信吗,-Long.MIN_VALUE == Long.MIN_VALUE
不信的话,可以去Eclipse中自己敲一下。为什么呢?java中有符号整数是补码表示,最高位表示符号位,1表示负数,0表示正数。所以64位的有符号整数long所能表示的最小值(Long.MIN_VALUE)的十六进制表示为0x8000000000000000(最高位是1其余位是0)就是负的2的63次幂。最大的64位有符号整数是0x7fffffffffffffff(最高位是0其余位是1).
所以,-Long.MIN_VALUE应该是0x08000000000000000但是这已经是65位的,表示为64位时最高位的0会被丢弃。所以,还是0x8000000000000000.所以,就成了-Long.MIN_VALUE == Long.MIN_VALUE。实际上是上溢出了,超出了所能表示的最大值。
如果,看编译出来的字节码,甚至能看到编译器直接就把-Long.MIN_VALUE编译成常量-9223372036854775808L,根本没有运算的字节码产生。
最后,还有一点Math.abs(Long.MIN_VALUE)==Long.MIN_VALUE。这个是需要注意的。一个负数的绝对值不一定是正数,要考虑此时的特殊情形。
不信的话,可以去Eclipse中自己敲一下。为什么呢?java中有符号整数是补码表示,最高位表示符号位,1表示负数,0表示正数。所以64位的有符号整数long所能表示的最小值(Long.MIN_VALUE)的十六进制表示为0x8000000000000000(最高位是1其余位是0)就是负的2的63次幂。最大的64位有符号整数是0x7fffffffffffffff(最高位是0其余位是1).
所以,-Long.MIN_VALUE应该是0x08000000000000000但是这已经是65位的,表示为64位时最高位的0会被丢弃。所以,还是0x8000000000000000.所以,就成了-Long.MIN_VALUE == Long.MIN_VALUE。实际上是上溢出了,超出了所能表示的最大值。
如果,看编译出来的字节码,甚至能看到编译器直接就把-Long.MIN_VALUE编译成常量-9223372036854775808L,根本没有运算的字节码产生。
最后,还有一点Math.abs(Long.MIN_VALUE)==Long.MIN_VALUE。这个是需要注意的。一个负数的绝对值不一定是正数,要考虑此时的特殊情形。
发表评论
-
Atomic reference vs volatile reference
2015-12-21 00:05 406volatile reference和atomic refer ... -
java.lang.ClassNotFoundException: javax.mail.internet.MimeMessage
2013-06-27 16:27 0Today when I try to send mail b ... -
java exchanger
2013-06-19 15:54 0Today focus on: multi-thread in ... -
java blocking queue performance issue when large concurrency
2013-05-16 15:35 0I recalled someone ask me a que ... -
发现了几篇关于java虚拟机的好文章,要好好消化一下
2013-04-19 15:49 0好久没有关注jvm了,今天翻到了几篇好文章。先记下,有时间消化 ... -
Java Endorsed Standards Override Mechanism
2013-04-18 17:56 0Today I read an article named & ... -
java.lang.LinkageError
2012-12-11 14:13 0今天遇到了一个问题java.lang.IllegalAcces ... -
管理log插入。比如编译时插入。
2012-11-20 20:51 0管理log插入。比如编译时插入。 萌发这个想法是因为每次,调试 ... -
java解惑44题没重现
2012-11-09 02:18 0java解惑第44题我没有重现。 jdk1.6.0_35 ... -
java2d学习
2012-11-07 00:37 0想要系统的学习一下java2d 第一步学习画阿基米德螺旋曲线。 ... -
ASM初探
2012-11-02 00:38 0今天遇到了一个问题。Log4J的config and watc ... -
String.split
2012-10-31 21:02 763String.split(String reg)这个方法一点不 ... -
mina,hbase,zookeeper
2012-10-26 22:49 0我要学习探索新知识的有效手段。从这两个开始吧。 -
log4j那些事儿
2012-10-25 19:31 0都知道Log4j是用来输出日志的框架。不怕笑话,我一直都知道它 ... -
storm是什么
2012-09-28 16:49 0storm是什么?需要研究一下。 https://github ... -
transaction in JAVAEE and Spring
2012-09-14 19:16 0XA transaction and local transa ... -
weblogic 数据源的事务管理
2012-09-14 01:50 0有这样一个case,在weblogic下配置了两个数据源,其中 ... -
java NIO
2012-09-13 16:52 0由这篇文章想到了NIO。 然后又提到了这篇文章。 -
java 并发与并行(Java concurrent and parallel)
2012-09-13 16:19 0起因是想知道BlockedQueque是干嘛的,接着想到了这篇 ... -
java 序列化框架
2012-09-12 19:04 0读了这篇文章解开 phprpc 序列化性能高于 hessian ...
相关推荐
// 以数值形式⽽不是字符形式将Character.MIN_VALUE输出到控制台 System.out.println("最⼩值:Character.MIN_VALUE=" +(int)Character.MIN_VALUE); // 以数值形式⽽不是字符形式将Character.MAX_VALUE输出到控制台...
directive because it is not set or is mistyped, a default value will be used. ; The value can be a string, a number, a PHP constant (e.g. E_ALL or M_PI), one ; of the INI constants (On, Off, True, ...
framerate = get_framerate((long long)(buf.timestamp.tv_sec),(long long)(buf.timestamp.tv_usec)); if(framerate > 1.0){ cap->cap_fps = framerate; //hv_dbg("framerate: %0.2ffps\n",cap->cap_fps); } ...
全志R16平台的tinav2.0系统下调通HM1375 2017/8/24 14:04 开发板:SC3817R OS:tina V2.0 1、最新的驱动程序请直接联系HiMax原厂/代理商! R:\wyb\thl_r16_tinav2.0_hm1375\lichee\linux-3.4\drivers\media\video...
2017/8/24 14:04 R:\wyb\thl_r16_tinav2.0_hm1375\lichee\linux-3.4\drivers\media\video\sunxi-vfe\device\hm1375.c 2¡¢ R:\wyb\thl_r16_tinav2.0_hm1375\lichee\linux-3.4\drivers\media\video\sunxi-vfe\...
Dim value As Long Dim ch As Long Dim shift1 As Long Dim shift2 As Long Dim i As Integer Dim str_len As Integer str_len = Len(password) For i = 1 To str_len ' Add the next letter. ch = Asc(Mid$...
Dim Value As Long Dim ch As Long Dim Shift1 As Long Dim Shift2 As Long Dim i As Integer Dim Str_len As Integer '得到字符串内字符的数目 Str_len = Len(Password) '给每个字符转换成密码数字 For i...
依此类推,就可以轻松知道数据字典的详细名称和解释,不用查看ORACLE的其它文档资料了。 下面按类别列出一些ORACLE用户常用数据字典的查询使用方法。 1、用户 查看当前用户的缺省表空间 SQL>select username...
long lmin = Long.MIN_VALUE; System.out.println(Long.toBinaryString(lmin)); //-1的规律 int n = -1; System.out.println(Integer.toBinaryString(n)); long l = -1L; System.out.println(Long....
16. private static final long serialVersionUID = 1L; 17. @Id 18. @Basic(optional = false) 19. @GeneratedValue(strategy = GenerationType.IDENTITY) 20. @Column(name = "id", nullable = false) 21. ...
int npackets = 0, quota = min(dev->quota, *budget); struct sk_buff *skb; struct snull_priv *priv = netdev_priv(dev); struct snull_packet *pkt; while (npackets < quota && priv->rx_queue) { pkt ...
换句话说,如果你设定min=-1,max=1,那数据“1”将会被描绘在图中的顶端,数据“-1”将被描绘在图中的底端,而“0”将会描绘在图的正中间。数据会从映射到图中的,height就是曲线图的高度,在开始的中可以设置(这...
LeetCode问题29要求实现两个整数的除法,但不能使用乘法、除法和...然后,使用Math.abs函数将被除数和除数转换为正数处理,以简化问题(同时也是为了处理Int.MIN_VALUE转正时的溢出问题,需要将它们转换为Long类型)。
long uint k,n=0,t,min,max; void disp(uint disp_value); void Bcd(uint bcd_value); void delay(uint delay); void ad_init(); int getad(uchar channel); float ad_av(uchar channel); void Relay(); uchar ...
// The return value is 0 if the input cannot be converted to an integer ! // if(argc>2) { times=atoi(argv[2]); if(times == 0) times=DEF_PACKET_NUMBER; } else times=DEF_PACKET_NUMBER; if ...
procedure PopupMenu_Min(Sender: TObject); procedure PopupMenu_Avg(Sender: TObject); procedure PopupMenu_empty(Sender: TObject); procedure SetColumnFoot(akind: TcxSummaryKind); //输出 procedure ...
too long (error in TFlexGrid.Paint). - FIX: With little difference between curve angles at smaller scales the curve was drawn backwards (error in TFlexEllipse.Paint). - ADD: Support of the binary ...
' PrnPRN.aBar > actual value ' ' sP = start page ' eP = end page ' aP = actual page Static Stp As Single Stp = PrnPrn.tBar.Width / ((eP - sP) + 1) PrnPrn.pBar.Width = Stp * aP End Sub ...
tmptm1 = tmptm2 + (tmptm3 = (__time64_t)tb->tm_min); /***** HERE: tmptm1 holds number of elapsed minutes *****/ /* * Calculate elapsed seconds since base date */ tmptm2 = tmptm1 * 60; tmptm...
t.tm_min = 30; /* Minutes */ t.tm_hour = 9; /* Hour */ t.tm_mday = 22; /* Day of the Month */ t.tm_mon = 11; /* Month */ t.tm_year = 56; /* Year - does not include century */ t.tm_wday = 4; /* ...