Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #33883 > unrolled thread

Re: double-to-int conversion without a cast

Started byMike Amling <mamling@chaff.us>
First post2016-02-25 12:37 -0600
Last post2016-02-25 12:37 -0600
Articles 1 — 1 participant

Back to article view | Back to comp.lang.java.programmer

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: double-to-int conversion without a cast Mike Amling <mamling@chaff.us> - 2016-02-25 12:37 -0600

#33883 — Re: double-to-int conversion without a cast

FromMike Amling <mamling@chaff.us>
Date2016-02-25 12:37 -0600
SubjectRe: double-to-int conversion without a cast
Message-ID<nanhf2$8k6$1@dont-email.me>
On 2/24/16 7:07 PM, Stefan Ram wrote:
>    At a point in my course, I have only introduced basic
>    arithmetic operations and calls of static methods and
>    the types »int«, »double«, and »java.lang.String«.
>
>    I already can show them how to convert from int to double
>    (»* 1.0«) or between the numbers and »java.lang.String«
>    (calling conversion methods from the Java SE standard
>    library).
>
>    But I am not aware of how to convert from double to int
>    with only the above means. The standard library is large.
>    Maybe there is a static method that takes a double and returns
>    it's floor or rounded value as an int and I am not aware of it?
>
>    I don't need this. I just ask for curiosity.

Have you looked at Double.intValue()? Granted, that brings in 
java.lang.Double.

Mike Amling
--
VGhpcyBpcyBvbmx5IGdvaW5nIHRvIGV4YWNlcmJhdGUgdGhlICJhbGwgZGF0YSBtdXN0IGJlIHN0
b3JlZCBhcyBTdHJpbmciIG1lbWUu

[toc] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web