我总是记不住电话号码。我需要一个记忆规则。


当前回答

如果你觉得以10为进制很难记住这个值,试试以2为进制: 1111111111111111111111111111111

其他回答

使用Java 9的REPL, jshell:

$ jshell
|  Welcome to JShell -- Version 9-Debian

jshell> System.out.println(Integer.MAX_VALUE)
2147483647

最简单的方法是查看std::numeric_limits< int >::max()

例如(来自MSDN),

// numeric_limits_max.cpp

#include <iostream>
#include <limits>

using namespace std;

int main() {
   cout << "The maximum value for type float is:  "
        << numeric_limits<float>::max( )
        << endl;
   cout << "The maximum value for type double is:  "
        << numeric_limits<double>::max( )
        << endl;
   cout << "The maximum value for type int is:  "
        << numeric_limits<int>::max( )
        << endl;
   cout << "The maximum value for type short int is:  "
        << numeric_limits<short int>::max( )
        << endl;
}

这里有一个记忆2**31,减去1得到最大整数值的助记符。

a = 1, b = 2, c = 3 d = 4 = 5, f = 6 g = 7, 8 h = = 9

Boys And Dogs Go Duck Hunting, Come Friday Ducks Hide
2    1   4    7  4    8        3    6      4     8

我经常使用2到18的幂来记住它们,但即使是我也没有费心去记住2**31。根据需要计算或使用常数,或估计为2G太容易了。

“如果一个巨大的整数没有被回忆起,你就回忆这个助记符。”

现在数数每个单词中的字母。

32位,1位符号,31位信息

2^31 - 1 = 2147483647

为什么1 ? 因为第一个是0,所以最大的是count - 1。

编辑cantfindaname88

计数是2^31,但最大的不可能是2147483648(2^31),因为我们是从0开始计数的,而不是1。

Rank   1 2 3 4 5 6 ... 2147483648
Number 0 1 2 3 4 5 ... 2147483647

另一种解释只有3位:1位是符号,2位是信息

2^2 - 1 = 3

下面是所有可能的3位值:(2^3 = 8个值)

1: 100 ==> -4
2: 101 ==> -3
3: 110 ==> -2
4: 111 ==> -1
5: 000 ==>  0
6: 001 ==>  1
7: 010 ==>  2
8: 011 ==>  3