Results 1 to 3 of 3
  1. #1
    ccie007 is offline Senior Member
    Join Date
    May 2010
    Posts
    112
    Rep Power
    0

    Default BigInteger value of

    I copied this code from a book on Eclipse but when I tried to run it there are red underlines under "valueOf".

    Everything is fine except from these 3 terms "valueOf".I wonder if any body got a clue.This full code is below:=
    Java Code:
    import java.math.*;
    import java.util.*;
    
    public class BigInteger
    {
        public static void main (String []args)
        {
            Scanner in = new Scanner(System.in);
            
            System.out.println("How many numbers do you need to draw ?");
            int k = in.nextInt();
            
            System.out.print("What is the highest number you can draw ?");
            int n = in.nextInt();
            
            BigInteger lotteryodds = BigInteger.valueOf(1);
            
            for(int i = 1; i <=k; i++)
                lotteryodds = lotteryodds
                .multiply(BigInteger.valueOf(n - i + 1))
                .divide(BigInteger.valueOf(i));
            
            System.out.println("Your odds are in 1 in "+ lotteryodds +".Good luck");
            
            
        }
        }

  2. #2
    ccie007 is offline Senior Member
    Join Date
    May 2010
    Posts
    112
    Rep Power
    0

    Default Resolved

    I fixed the problem.

    I was missing this line at the top

    Java Code:
    import java.math.BigInteger;

  3. #3
    kishore001 is offline Member
    Join Date
    Sep 2010
    Posts
    1
    Rep Power
    0

Similar Threads

  1. convert BigInteger
    By bobo67 in forum New To Java
    Replies: 1
    Last Post: 09-01-2010, 03:00 PM
  2. BigInteger
    By windows.login in forum New To Java
    Replies: 8
    Last Post: 07-13-2010, 02:10 PM
  3. very new... Biginteger problems
    By willemien in forum New To Java
    Replies: 6
    Last Post: 05-02-2010, 04:17 PM
  4. My own BigInteger class. Need help.
    By Dinde in forum New To Java
    Replies: 2
    Last Post: 01-27-2010, 09:49 PM
  5. how to convert from BigInteger to Hex
    By nanaji in forum Advanced Java
    Replies: 10
    Last Post: 05-22-2008, 01:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •