title: Java - Converting hours(in double) to minutes(integer) and vice versa
body: <p>I need the correct formula that will convert hours to minutes and vice versa.
  I have written a code, but it doesn't seem to work as expected. 
  For eg:
  If I have hours=8.16, then minutes should be 490, but I'm getting the result as 489.</p>
  
  <pre><code>  import java.io.*;
    class DoubleToInt {
  
    public static void main(String[] args) throws IOException{
  
    BufferedReader buff = 
    new BufferedReader(new InputStreamReader(System.in)); 
    System.out.println("Enter the double hours:");
    String d = buff.readLine();
  
    double hours = Double.parseDouble(d);
    int min = (int) ((double)hours * 60);
  
    System.out.println("Minutes:=" + min);
    }
  } 
  </code></pre>