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


Groups > comp.lang.java.help > #815

Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()?

From "Thee Chicago Wolf [MVP]" <.@.>
Newsgroups comp.lang.java.help
Subject Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()?
Date 2011-07-05 10:30 -0500
Organization .
Message-ID <3bb617hgmi4kcjttiqj2tsv4vh3hh385uh@4ax.com> (permalink)
References <521s0711i3d7bsc8620isi0oiidl91kujq@4ax.com> <ejo317hlv3sbq7qd4ahrqs168ojhea6jv7@4ax.com>

Show all headers | View raw


>On Fri, 01 Jul 2011 12:53:07 -0500, "Thee Chicago Wolf [MVP]" <.@.>
>wrote, quoted or indirectly quoted someone who said :
>
>>Doing homework for a programming course and we're given a 1000 digit
>>String which we have to convert to integer, load into an array, and
>>then find the largest product of a group of 5 integers. 
>
>Your basic problem is you can't store a 1000 digit number in a 32-bit
>int. This is what BigInt and BigDecimal do for a living.  At your
>stage they might want you to store the integer as an array of ints
>each 0..9.
>
>see http://mindprod.com/jgloss/primitive.html
>http://mindprod.com/jgloss/bigint.html
>http://mindprod.com/jgloss/bigdecimal.html

Yup, it will crash out when trying to do a String more than 9 chars
long. Ideally, it's the long, hard way to do this which I believe is
the professors intent to get us used to loading the array and doing a
loop for testing the whole thing. I was just thinking it would be nice
to do it an easier way if it were possible.

I'll look into bigint and see if I can use it. If not, no big deal. I
can live with doing it the hard way and come back to it later on and
fiddle with it.

- Thee Chicago Wolf [MVP]

Back to comp.lang.java.help | Previous | NextPrevious in thread | Find similar


Thread

Convert a String to Int: can I use toInt() instead of Integer.parseInt()? "Thee Chicago Wolf [MVP]" <.@.> - 2011-07-01 12:53 -0500
  Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? Jeff Higgins <jeff@invalid.invalid> - 2011-07-01 17:55 -0400
  Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? markspace <-@.> - 2011-07-01 18:19 -0700
    Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? "Thee Chicago Wolf [MVP]" <.@.> - 2011-07-05 10:26 -0500
      Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-07-05 13:39 -0400
        Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? "Thee Chicago Wolf [MVP]" <.@.> - 2011-07-05 13:57 -0500
          Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? markspace <-@.> - 2011-07-05 13:01 -0700
            Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? "Thee Chicago Wolf [MVP]" <.@.> - 2011-07-05 15:47 -0500
              Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? markspace <-@.> - 2011-07-05 14:57 -0700
                Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? "Thee Chicago Wolf [MVP]" <.@.> - 2011-07-06 13:11 -0500
                Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? markspace <-@.> - 2011-07-06 11:54 -0700
                Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? "Thee Chicago Wolf [MVP]" <.@.> - 2011-07-06 16:58 -0500
                Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? markspace <-@.> - 2011-07-06 15:36 -0700
                Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? Patricia Shanahan <pats@acm.org> - 2011-07-06 16:53 -0700
                Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? markspace <-@.> - 2011-07-06 18:07 -0700
              Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? Nigel Wade <nmw-news@ion.le.ac.uk> - 2011-07-06 09:57 +0100
                Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? "Thee Chicago Wolf [MVP]" <.@.> - 2011-07-06 13:13 -0500
                Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? Nigel Wade <nmw-news@ion.le.ac.uk> - 2011-07-07 09:43 +0100
              Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? Lothar Kimmeringer <news200709@kimmeringer.de> - 2011-07-06 11:15 +0200
                Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? "Thee Chicago Wolf [MVP]" <.@.> - 2011-07-06 13:14 -0500
          Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-07-05 16:27 -0400
            Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? Lothar Kimmeringer <news200709@kimmeringer.de> - 2011-07-06 11:22 +0200
              Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-07-06 07:33 -0400
  Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-07-01 23:06 -0400
    Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? Patricia Shanahan <pats@acm.org> - 2011-07-01 20:28 -0700
    Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? "Thee Chicago Wolf [MVP]" <.@.> - 2011-07-05 10:27 -0500
  Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? Roedy Green <see_website@mindprod.com.invalid> - 2011-07-04 08:59 -0700
    Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? "Thee Chicago Wolf [MVP]" <.@.> - 2011-07-05 10:30 -0500

csiph-web