0
我有这样的代码片段:截断toBinaryString否定回答
String negativeBinary = "";
negativeBinary = Integer.toBinaryString(decimal);
System.out.println(negativeBinary);
其中给出了一个答案:在输入时-5 11111111111111111111111111111011。
是否有反正切断领先1的限制答案只说10位数? 谢谢。
我不认为这是有帮助的,如果减少了你能处理数字的大小。试试'Short'而不是'Integer' – MozenRath 2012-02-12 17:09:57
它只需要超过512个符号,所以这些都很难看。 – 2012-02-12 17:28:59
为什么不单独存储标志?我认为这对你最好 – MozenRath 2012-02-12 18:18:13