Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: numberformatexception

  1. #1
    Junior Member
    Join Date
    Feb 2013
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default numberformatexception

    I want to calculate

    ???? number1 = 182316110001234567232100
    int number2 = 97

    int value = (int)(number1 % number2)

    the result must be 78 (check by windows calculator)

    How do i have to declare number1.

    I tried everything float, long, double noting works. float gives me value 67 but that isn't ride.


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: numberformatexception

    Try the BigInteger class for that large number.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Feb 2013
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: numberformatexception

    Thx,
    problem solved.

Similar Threads

  1. (java.lang.NumberFormatException: null) error
    By vishnuib2000 in forum JavaServer Pages: JSP & JSTL
    Replies: 1
    Last Post: April 2nd, 2012, 08:09 AM
  2. [SOLVED] Converting primitive data types causing NumberFormatException
    By Melawe in forum What's Wrong With My Code?
    Replies: 11
    Last Post: December 10th, 2011, 12:30 AM
  3. java.lang.numberformatexception error
    By natalie in forum What's Wrong With My Code?
    Replies: 3
    Last Post: February 19th, 2010, 04:16 AM
  4. Replies: 1
    Last Post: January 15th, 2010, 01:32 AM