martes, 2 de octubre de 2007

Java: convertir un double a int

Referencias:
  • http://forum.java.sun.com/thread.jspa?threadID=609720
Para convertir un double a int, redondeando siempre hacia abajo, hacer lo siguiente:
  • int d = (int) x;
o bien
  • int d = (int) Math.floor(x);
Por ejemplo, si x fuese 2.75, con este método, d pasaría a valer 2. Podemos pensarlo como que se quitan los dígitos decimales.

42 comentarios:

  1. Muchas Gracias, no sabia como utilizarlo.
    Pero considero que se te olvido mencionar que x es un valor double. GRacias
    Desde Huixquilucan edo. de México. www.servicom.es.tl

    ResponderEliminar
  2. gracias no sabia como usarlo.......

    ResponderEliminar
  3. Y porque a mi no me da resultado?

    ResponderEliminar
  4. Una disculpa.

    ¡Si Funciona!

    Yo tenia un error.

    Gracias.

    ResponderEliminar
  5. Preciso, conciso y excelente.

    ResponderEliminar
  6. vale perro te pasaste, me sirvió

    ResponderEliminar
  7. lo maximo me rompia la cabeza pensando, pero ya me salio mi problema ,, thanksss

    ResponderEliminar
  8. Este comentario ha sido eliminado por el autor.

    ResponderEliminar
  9. Muchas gracias... como dijeron antes, rápido, conciso y efectivo. Muchas gracias nuevamente.

    ResponderEliminar
  10. buena gracias por el aporte esta buenísimo una consulta para obtener la parte decimal como hago?

    ResponderEliminar
  11. decir que quita las decimales está correcto, que redondea hacia abajo no siempre.

    sea x un valor double negativo, entonces (int) x redondea hacia arriba, quitándo las decimales

    ResponderEliminar
  12. [url=http://loveepicentre.com/][img]http://loveepicentre.com/uploades/photos/4.jpg[/img][/url]
    internet dating service uk 20 [url=http://loveepicentre.com/]rashida jones who she dating[/url] dating etiquettes
    who is ethan hawke dating [url=http://loveepicentre.com/faq.php]dating wiki[/url] dating lazy men
    friend finder and adult dating sites [url=http://loveepicentre.com/articles.php]needs assessment virginia dating violence[/url] youth emotional dating violence statics

    ResponderEliminar
  13. [url=http://loveepicentre.com/advice.php][img]http://loveepicentre.com/uploades/photos/1.jpg[/img][/url]
    dating that deaf love site [url=http://loveepicentre.com/articles.php]fun dating 2007 jelsoft enterprises ltd[/url] teen dating going to her house
    online dirty dating [url=http://loveepicentre.com/advice.php]dating malaysia women[/url] dating without drama
    free email fo dating [url=http://loveepicentre.com]bow wow and ciara dating[/url] dating with stds

    ResponderEliminar
  14. ebook crc press rf and microwave http://audiobookscollection.co.uk/Michael-F-Roizen/m87227/ ebook torrent joseph cancellaro [url=http://audiobookscollection.co.uk/We-Are-All-Self-Employed-How-to-Take-Control-of-Your-Career/p148670/]sony ebook battery life[/url] kenneth blanchard raving fans ebook

    ResponderEliminar
  15. excellent publish, very informative. I ponder why the other specialists of this sector don't realize this. You should proceed your writing. I'm confident, you've a huge readers' base already!
    Also visit my webpage : montel cash advance

    ResponderEliminar
  16. scarlet ebook http://audiobookscollection.co.uk/es/Automata-and-Computability/p224505/ php ajax free ebook [url=http://audiobookscollection.co.uk/fr/The-Industrial-Vagina-The-Political-Economy-of-the-Global-Sex-Trade/p199031/]ebook download epub dictionary[/url] free religious ebook downloads

    ResponderEliminar
  17. millennium ebook project http://audiobookscollection.co.uk/es/Understanding-the-Medical-Diagnosis-of-Child-Maltreatment-A-Guide-for-Nonmedical-Professionals/p227197/ free harry potter ebook [url=http://audiobookscollection.co.uk/Supermodularity-and-complementarity/p179413/]chapter 6 ebook cisco[/url] penacho de moctezuma ebook

    ResponderEliminar
  18. Hey there I am so delighted I found your website,
    I really found you by mistake, while I was browsing on Bing for something else,
    Anyhow I am here now and would just like to say kudos
    for a tremendous post and a all round exciting blog (I also love the theme/design), I don’t have
    time to read it all at the moment but I have book-marked it and also added your RSS
    feeds, so when I have time I will be back to read more, Please do
    keep up the superb b.

    Feel free to surf to my homepage ... read more here

    ResponderEliminar
  19. organizers software download http://buyoem.co.uk/de/product-13747/Microsoft-Windows-XP-Professional-SP3 seo software kyrgyzstan [url=http://buyoem.co.uk/product-16579/Maxwell-1-5-Mac]what is pim software[/url] silverlining software
    [url=http://buyoem.co.uk/category-100-101/Operation-Systems?page=3]Operation Systems - Software Store[/url] add menu dvd shrink free software
    [url=http://buyoem.co.uk/it/product-16128/Adobe-Acrobat-8-Professional-Mac][img]http://buyoem.co.uk/image/4.gif[/img][/url]

    ResponderEliminar
  20. board circuit design printed software http://buyoemsoftware.co.uk/de/product-37184/Webpage-Maker-2-5 what software do disney animators use [url=http://buyoemsoftware.co.uk/it/home]dvd audio burning software free[/url] wep key cracking software
    [url=http://buyoemsoftware.co.uk/es/product-23743/Adobe-Contribute-CS4-Mac]Adobe Contribute CS4 [Mac] - Cheap Legal OEM Software, Software Sale, Download OEM[/url] sibelius music writing software
    [url=http://buyoemsoftware.co.uk/fr/product-35471/Kristanix-Password-Manager-Deluxe-3-8][img]http://buyoem.co.uk/image/8.gif[/img][/url]

    ResponderEliminar
  21. [url=http://onlinemedistore.com/catalogue/d.htm][img]http://onlinemedistore.com/6.jpg[/img][/url]
    pharmacy minor ailments scheme http://onlinemedistore.com/products/epivir.htm compounding pharmacy san diego [url=http://onlinemedistore.com/products/leukeran.htm]cliffton burtt brooks pharmacy wayland ma robbed[/url]
    cals pharmacy snowbords http://onlinemedistore.com/refer-a-friend.htm pharmacy epos [url=http://onlinemedistore.com/products/xplode--stamina--energy-and-sex-enhancer-.htm]xplode stamina energy and sex enhancer [/url]
    wayne pharmacy goldsboro http://onlinemedistore.com/products/diclofenac-gel.htm marrakech argane oil pharmacy [url=http://onlinemedistore.com/categories/women-s-health.htm]sports nutrition compounding pharmacy[/url]
    the pharmacy channel http://onlinemedistore.com/products/omnicef.htm pharmacy ultram [url=http://onlinemedistore.com/products/voltaren.htm]voltaren[/url]

    ResponderEliminar
  22. [url=http://redbrickstore.co.uk/products/trimox.htm][img]http://onlinemedistore.com/12.jpg[/img][/url]
    pharmacy cartoons http://redbrickstore.co.uk/products/famvir.htm costco pharmacy prices [url=http://redbrickstore.co.uk/products/menosan.htm]florida pharmacy[/url]
    online pharmacy direct scripts http://redbrickstore.co.uk/products/diclofenac.htm pharmacy management [url=http://redbrickstore.co.uk/products/vantin.htm]vantin[/url]
    no prescription pharmacy diazepam http://redbrickstore.co.uk/products/menosan.htm hippa pharmacy confidentiality [url=http://redbrickstore.co.uk/products/hard-on-oral-jelly.htm]requirements for pharmacy tech il license[/url]
    nanotechnology in pharmacy practice http://redbrickstore.co.uk/products/cok-n--energy-and-sensory-enhancer-.htm post subject sun pharmacy re consult board ignore info [url=http://redbrickstore.co.uk/products/atrovent.htm]atrovent[/url]

    ResponderEliminar
  23. [url=http://certifiedpharmacy.co.uk/products/claritin.htm][img]http://onlinemedistore.com/3.jpg[/img][/url]
    cvs pharmacy buffalo http://certifiedpharmacy.co.uk/categories/female-enhancement.htm kirk calvert signature pharmacy additional [url=http://certifiedpharmacy.co.uk/products/calan.htm]canadian pharmacy technicians educator[/url]
    continuing education pharmacy http://certifiedpharmacy.co.uk/products/amaryl.htm free pda pharmacy software [url=http://certifiedpharmacy.co.uk/products/himcolin.htm]himcolin[/url]
    remedy pharmacy torrance ca http://certifiedpharmacy.co.uk/products/requip.htm online pharmacy 500mg cipro [url=http://certifiedpharmacy.co.uk/products/torsemide.htm]mn pharmacy technician[/url]
    gulf shores pharmacy osteoporosis http://certifiedpharmacy.co.uk/products/diamox.htm osterhaus pharmacy [url=http://certifiedpharmacy.co.uk/products/viagra-jelly.htm]viagra jelly[/url]

    ResponderEliminar
  24. muy agradecido ... al fin lo pude hacer con tu aporte !! mil gracias

    ResponderEliminar
  25. Narrow blood vessels lie alongside the intestines of the earthworm and they absorb
    the nutrients from the alimentary canal feeding the rest of the body.
    Popular prizes include sports tickets, cash and vouchers for drinks, food - and dollars off of tabs.
    They feature almost nightly drink specials and some form of entertainment every night of the week--DJ's, live music, trivia, you name it.

    Visit my homepage: great pub quiz names

    ResponderEliminar
  26. D Minor:. Now among the advice of your educational materials, shoring jar discover all the things of the
    substitute chords. Pretend that we are palming an egg and keep
    your arms relaxed and fingers curled.

    Also visit my web-site - learn piano chords and notes

    ResponderEliminar
  27. Also, we need to determine the rounds of the quiz according
    to it. Brazenhead is a great place to go with your family or for a business
    lunch or dinner, but if you are looking for a party atmosphere, this isn't it. Her father, Bruce Paltrow, produced the critically acclaimed TV series that is considered the precursor to many medical shows today, St.

    Take a look at my web-site: pub quiz archives

    ResponderEliminar
  28. ' Satanic Ritual - Decorate the space with human sacrifice, goblets of blood, pentagrams, and things draped in black. You make different challenges like scavenger hunts, food challenges, mazes and races. That is the new craze in on the internet gaming, and numerous girls and teens are possessing a blast.

    my weblog - antiterrorism

    ResponderEliminar
  29. In other words, they go against the grain of the careers their parents had.
    Local country clubs are offering trivia fun for as little as forty dollars per couple.
    Her father, Bruce Paltrow, produced the critically acclaimed TV
    series that is considered the precursor to many medical shows
    today, St.

    My page good pub quiz names

    ResponderEliminar
  30. In that case, this kind of question should not be taken
    from any show telecasted in specific country. At the end of each round read out the cumulative scores.
    28.

    Take a look at my homepage :: pub quiz and answers

    ResponderEliminar
  31. On Sunday nights Erin Jaimes hosts a blues jam where anyone from Alan
    Haynes to Gary Clark, Jr. Anna had been looking through my phone while I
    was naked. Theme Format: It is almost like standard format of the pub quiz.


    My website; pub quiz and answers general knowledge

    ResponderEliminar
  32. rank dating sites http://loveepicentre.com muslim dating realities
    t girl dating [url=http://loveepicentre.com/map/]bbw dating services[/url] civil war dating websites
    free goth dating site [url=http://loveepicentre.com/advice/]no charg dating sites[/url] women over40 dating sites [url=http://loveepicentre.com/user/modleboi713/]modleboi713[/url] free dating encounters

    ResponderEliminar
  33. On Sunday nights Erin Jaimes hosts a blues jam where anyone from Alan Haynes to Gary Clark,
    Jr. Brazenhead is a great place to go with your family or for a
    business lunch or dinner, but if you are looking for a party atmosphere,
    this isn't it. Theme Format: It is almost like standard format of the pub quiz.

    my webpage ... pub quiz archives

    ResponderEliminar
  34. free wives dating http://loveepicentre.com/success_stories/ dating sites photos
    dating for months [url=http://loveepicentre.com]free teacher dating site[/url] kyla pratt dating
    cleveland oh dating for handicapped [url=http://loveepicentre.com/advice/]why are you interested dating me[/url] dating a female vampire [url=http://loveepicentre.com/user/Konnay/]Konnay[/url] dating relationship tip

    ResponderEliminar
  35. Some were practical, of course, but others were psychological and emotional.
    Below are listed a few popular pubs where one can chill in Mumbai.
    8.

    Feel free to visit my weblog; free pub quiz and answers

    ResponderEliminar
  36. If your tween is into paint-ball you can take everyone
    to play paint-ball. I won't spoil your surprises and give away any more details. Play games all night long in keeping with the twenties theme such as various card games and crossword puzzles.

    My blog post; borders

    ResponderEliminar
  37. (Thank you rounds are always welcome, of course.
    * Team answer sheets - Basically a grid lined A4 type sheet with
    answer write in numbered boxes and a line on top for the team name.
    28.

    my website brainstormer pub quiz answers

    ResponderEliminar
  38. DJ spins out on Saturday nights. Popular prizes include sports tickets, cash and
    vouchers for drinks, food - and dollars off
    of tabs. The Bull's Head Pub, Bangkok.

    My web site :: pub quiz area ()

    ResponderEliminar
  39. Muchas gracias :) me sirvio n_n

    ResponderEliminar