LoginSignup
0
0

More than 5 years have passed since last update.

数値型項目の桁数

Last updated at Posted at 2019-03-28

小さめのID項目の型どうしようかな?
そもそもIntegerの桁数の最大っていくつだっけな?

Integer 10桁
→じゃあ9桁以下の項目はIntegerかな。

Short 5桁
→じゃあ4桁以下の項目はshortかな。

byte 3桁
→じゃあ2桁以下の項目はbyteかな。

て考えてたら、

現在主流の32bit/64bitコンピューターではJavaに限らずIntegerが一番性能よいらしい。

確かに昔そんなこと習ったなって思い出した。

なので、Integerの上限を超えない数値はIntegerで定義かな。

参考:
Javaの整数型(long,int,short,byte)について
intはshortやbyteより高速に処理できる

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0