title: Cast problems between int and double
body: <p>This piece of code is giving the result I wanted</p>
  
  <pre><code>double a=Math.random()*100;
  int b=(int)a;
  System.out.println(b);
  </code></pre>
  
  <p>but when I did for the same thing this way, it is giving zero always</p>
  
  <pre><code>int a=(int)Math.random()*100;
  System.out.println(a);
  </code></pre>
  
  <p>As far as I know typecasting will store the bigger data-type to small. but in the later code, I'm gettig zero every single time I run the program.</p>