title: Is there any reason to still use int as opposed to long on a 64 bit machine?
body: <p>In general, is there any reason to still use <code>int</code> as opposed to <code>long</code> in Java if programming on a 64 bit architecture?</p>
  
  <p><strong>Specifically in my case:</strong></p>
  
  <p>I use <code>int</code> variables that are being mapped to keys(sequential numbers starting from 1 and incremented for each new entry) of type <a href="https://docs.oracle.com/cd/B19306_01/olap.102/b14346/dml_datatypes002.htm#CJACDECG" rel="nofollow">NUMBER</a> on an Oracle DB table. </p>
  
  <p>The DB type <code>NUMBER</code> has way more precision then <code>int</code> so the correct way to model this on the Java side would be <code>long</code>.</p>
  
  <p>I stuck to <code>int</code> for efficiency reasons and because probably we will never have so many entries in the table as to need more than an <code>int</code> can represent.</p>
  
  <p>On the other hand, since most modern machines are 64 bit anyways, it shouldn't make a difference regarding efficiency on the Java side to use <code>long</code> as opposed to <code>int</code>, right? I guess it would make a difference memory wise if you load huge lists of keys into memory but we are not doing this kind of operation.</p>