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:

Rosendo Antonio Manuel dijo...

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

Anónimo dijo...

gracias no sabia como usarlo.......

Jesús dijo...

Y porque a mi no me da resultado?

Jesús dijo...

Una disculpa.

¡Si Funciona!

Yo tenia un error.

Gracias.

Anónimo dijo...

Preciso, conciso y excelente.

Anónimo dijo...

vale perro te pasaste, me sirvió

Anónimo dijo...

Muchas Gracias

Anónimo dijo...

se le agradece...

Anónimo dijo...

Muchas gracias!!!! :3

Unknown dijo...

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

Unknown dijo...
Este comentario ha sido eliminado por el autor.
Anónimo dijo...

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

Anónimo dijo...

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

Anónimo dijo...

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

Anónimo dijo...

[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

Anónimo dijo...

[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

Anónimo dijo...

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

Anónimo dijo...

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

Anónimo dijo...

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

Anónimo dijo...

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

Anónimo dijo...

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

Anónimo dijo...

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]

Anónimo dijo...

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]

Anónimo dijo...

[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]

Anónimo dijo...

[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]

Anónimo dijo...

[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]

piedrucci dijo...

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

Anónimo dijo...

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

Anónimo dijo...

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

Anónimo dijo...

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

Anónimo dijo...

' 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

Anónimo dijo...

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

Anónimo dijo...

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

Anónimo dijo...

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

Anónimo dijo...

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

Anónimo dijo...

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

Anónimo dijo...

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

Anónimo dijo...

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

Anónimo dijo...

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

Anónimo dijo...

(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

Anónimo dijo...

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 ()

Anónimo dijo...

Muchas gracias :) me sirvio n_n