Page 1 of 2 12 LastLast
Results 1 to 20 of 28
  1. #1
    mzjazzygirl is offline Member
    Join Date
    Sep 2010
    Posts
    16
    Rep Power
    0

    Default Converting an integer into a BigInteger

    Hello All,

    I am working an assignment, and I am confused on how to convert an integer into a BigInteger. What I want to do is use the divideAndRemainder(BigInteger val) function, but to use this function I need to pass a BigInteger.

    I want to convert the integer 128 to a BigInteger.

    Below is my code:
    Java Code:
    import java.io.*;
    import java.math.*;
    import java.util.*;
    
    public class Homework1 {
    static BigInteger[] great; 
    static BigInteger[] key;
    static char[] plaintext = new char[1000];
    static int count;
    static int count1;
    static int count2;
    static long base = 128;
    static BigInteger base2 = BigInteger.valueOf(base); <--- This is where I 
    am trying to do the conversion, but it is not correct
    
    public static void readBigNumbers() throws IOException
    { FileReader fr = new FileReader("encryption.txt");
      BufferedReader br = new BufferedReader(fr);
      
    
      String line;
      System.out.println("New base from 128, to big integer... "+ base2);
      count = 0;
      while ((line = br.readLine()) != null)
          { great[count] = new BigInteger(line);
     	System.out.println(line);
            count++;
          }
      fr.close();
    }
    
    
    public static void readPlainText() throws IOException
    {
    
    FileReader fr1 = new FileReader("key.txt");
      BufferedReader br1 = new BufferedReader(fr1);
      String line;
    
      count1 = 0;
     while((line = br1.readLine()) != null)
        {
          key[count1] = new BigInteger(line);
          count1++;
         }
        fr1.close();
    
      FileReader fr2 = new FileReader("plaintext.txt");
      BufferedReader br2= new BufferedReader(fr2);
      String line1;
      String temp;
      int temp2[] = new int[10000];
      StringBuilder sb = new StringBuilder();
      BigInteger code;
    
      count2 = 0;
     while((line1 = br2.readLine()) != null)
        {
          line1.getChars(0, line1.length(), plaintext, 0);
          for(int k = 0; k < line1.length(); k++)
           {
            temp2[count2] = (int)plaintext[k];
            sb.append(temp2[count2]);
            count++;
           }
         }
        fr2.close();
       
        BigInteger temp3 = new BigInteger(sb.toString());
        code = temp3.multiply(key[0]);
        	
       try{
        PrintStream out = new PrintStream(new FileOutputStream("encryption.txt"));
        out.println(code);
        out.close();
       } catch (FileNotFoundException e) {
       e.printStackTrace();
     }
    }
    
    public static void main(String argv[])throws IOException
    {  great = new BigInteger[100];
       key = new BigInteger[5];
       String line;
       int selection = 0;
    
        System.out.println("Please make your selection.\n 1. Encryption \n 2. Decryption\n");
        try{
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        line = in.readLine();
        selection = Integer.parseInt(line);
        }
        catch (IOException e) {
        System.out.println("Unexpected IO Error: " + e);
        }
        switch(selection) {
    
        case 1: 
        System.out.println("You have selected Encryption.");
        readPlainText();
        System.out.println("The encryption.txt file has been created.");
        break;
    
        case 2:
        System.out.println("You have selected Decryption.");
        readBigNumbers();
        System.out.println("\n Printing from great[] \n");
        for (int i = 0; i < count; i++)
           System.out.println(great[i].toString());
        break;
       }
    
        
        System.out.println("\n *** Program Finished *** ");
    }
    
    }
    Any help would be great!

    Thanks.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,234
    Rep Power
    19

    Default

    Quote Originally Posted by mzjazzygirl View Post
    Java Code:
    static BigInteger base2 = BigInteger.valueOf(base); <--- This is where I 
    am trying to do the conversion, but it is not correct
    Define "not correct"

    Your stated problem is with creating a BigInteger. 99% of your code has nothing whatsoever to do with creating a BigInteger.

    Recommended reading: How To Ask Questions The Smart Way

    db

  3. #3
    mzjazzygirl is offline Member
    Join Date
    Sep 2010
    Posts
    16
    Rep Power
    0

    Default

    Thanks. I know that 99% of the code has nothing to do with the BigInteger, but I didn't want anyone to say, "Where's the rest of your code?"

    Also, i'm confused because when I System.out.println statement, the base2 shows 128 as opposed to the BigInteger equivalent.

    I hope, I am explaining my problem well.

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,397
    Rep Power
    25

    Default

    System.out.println statement, the base2 shows 128 as opposed to the BigInteger equivalent.
    Can you show what you think the BigInteger equivalent is?

  5. #5
    mzjazzygirl is offline Member
    Join Date
    Sep 2010
    Posts
    16
    Rep Power
    0

    Default

    Quote Originally Posted by Norm View Post
    Can you show what you think the BigInteger equivalent is?
    Norm,

    I don't know what the equivalent will be. My teacher stated that I will have to use the DivideandRemainder() function in Java. The parameter is of a BigInteger, so I am trying to convert my base of 128 (currently stored as an integer) to it's equivalent as a BigInteger.

    I hope that makes sense...

  6. #6
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,397
    Rep Power
    25

    Default

    I am trying to convert my base of 128 (currently stored as an integer) to it's equivalent as a BigInteger.
    The value 128 can be stored in many different data types including: unsigned byte, short, int, long and BigInteger. But no matter what data type it is in, its value is still 128.

    Why do you think using a BigInteger would change its value?

  7. #7
    mzjazzygirl is offline Member
    Join Date
    Sep 2010
    Posts
    16
    Rep Power
    0

    Default

    Quote Originally Posted by Norm View Post
    The value 128 can be stored in many different data types including: unsigned byte, short, int, long and BigInteger. But no matter what data type it is in, its value is still 128.

    Why do you think using a BigInteger would change its value?
    Norm,

    I guess I must have misinterpreted my teacher. He was stating in class that if we tried to put BigInteger base2 = 128, this will not work. I will try the DivideandRemainder() function with the BigInteger.valueOf, I just hope I do not get an error.

    Sorry if I am confusing you.

    Thanks

  8. #8
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,397
    Rep Power
    25

    Default

    BigInteger base2 = 128, this will not work
    That is correct. You would get an error.
    incompatible types
    found : int
    required: java.math.BigInteger

  9. #9
    mzjazzygirl is offline Member
    Join Date
    Sep 2010
    Posts
    16
    Rep Power
    0

    Default

    Quote Originally Posted by Norm View Post
    That is correct. You would get an error.
    Norm,

    Correct, that's what I got! Basically I am doing a homework assignment of a (very basic) Cryptosystem.

    I need to use the divideandRemainder() function for this assignment to divide my encryption by the key, and then by base 128.

    If I put BigInteger base2 = 128, I don't that will work.

    Basically, I am trying to find a way to get 128 as a BigInteger to use this function.

  10. #10
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,397
    Rep Power
    25

    Default

    What is wrong with what you originally posted:
    BigInteger base2 = BigInteger.valueOf(base);

  11. #11
    mzjazzygirl is offline Member
    Join Date
    Sep 2010
    Posts
    16
    Rep Power
    0

    Default

    Norm,

    I guess there's nothing wrong with it... I just misunderstood.

    Now I am having trouble using the divideAndRemainder() function in Java. Can you please take a look when you have a chance?

    Here's my code:
    Java Code:
    import java.io.*;
    import java.math.*;
    import java.util.*;
    
    public class Homework1 {
    static BigInteger[] great; 
    static BigInteger[] key;
    static char[] plaintext = new char[1000];
    static int count;
    static int count1;
    static int count2;
    static long base = 128;
    static BigInteger base2 = BigInteger.valueOf(base);
    
    public static BigInteger readKey() throws IOException
    {
      FileReader fr1 = new FileReader("key.txt");
      BufferedReader br1 = new BufferedReader(fr1);
      String line;
      count1 = 0;
     while((line = br1.readLine()) != null)
        {
          key[count1] = new BigInteger(line);
          //System.out.println("Line... " +line);
          count1++;
         }
         //System.out.println("Let's see... "+ key[0]);
        fr1.close();
    return key[0];
    }
    
    public static void readPlainText() throws IOException
    {
      FileReader fr2 = new FileReader("plaintext.txt");
      BufferedReader br2= new BufferedReader(fr2);
      String line1;
      String temp;
      int temp2[] = new int[10000];
      StringBuilder sb = new StringBuilder();
      BigInteger code;
    
      count2 = 0;
     while((line1 = br2.readLine()) != null)
        {
          line1.getChars(0, line1.length(), plaintext, 0);
          for(int k = 0; k < line1.length(); k++)
           {
            temp2[count2] = (int)plaintext[k];
            sb.append(temp2[count2]);
            count++;
           }
         }
        fr2.close();
       
        BigInteger temp3 = new BigInteger(sb.toString());
        code = temp3.multiply(key[0]);
        	
       try{
        PrintStream out = new PrintStream(new FileOutputStream("encryption.txt"));
        out.println(code);
        out.close();
       } catch (FileNotFoundException e) {
       e.printStackTrace();
     }
    }
    
    public static void readBigNumbers(BigInteger temp3) throws IOException
    { FileReader fr = new FileReader("encryption.txt");
      BufferedReader br = new BufferedReader(fr);
      
    
      String line;
      //System.out.println("New base from 128, to big integer... "+ base2);
      count = 0;
      while ((line = br.readLine()) != null)
          { great[count] = new BigInteger(line);
     	//System.out.println(great[count]);
            count++;
          }
      fr.close();
    
      System.out.println("Test 1... "+great[0]); //Encryption file
      System.out.println("Test 2... "+temp3); //Key
      
      BigInteger storage = new BigInteger(great[0].toString());
      BigInteger k_temp = new BigInteger(temp3.toString());
      System.out.println("Prelim test..." +storage);
      System.out.println("New prelim test..." +k_temp);
      
      BigInteger storage1;
      storage1 = storage.divideAndRemainder(k_temp);
    
    
      
    }
    
    public static void main(String argv[])throws IOException
    {  great = new BigInteger[100];
       key = new BigInteger[5];
       String line;
       int selection = 0;
       BigInteger temp2;
    
        System.out.println("Please make your selection.\n 1. Encryption \n 2. Decryption\n");
        try{
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        line = in.readLine();
        selection = Integer.parseInt(line);
        }
        catch (IOException e) {
        System.out.println("Unexpected IO Error: " + e);
        }
        switch(selection) {
    
        case 1: 
        System.out.println("You have selected Encryption.");
        temp2 = readKey();
        readPlainText();
        System.out.println("The encryption.txt file has been created.");
        break;
    
        case 2:
        System.out.println("You have selected Decryption.");
        temp2 = readKey();
        readBigNumbers(temp2);
       /* System.out.println("\n Printing from great[] \n");
        for (int i = 0; i < count; i++)
           System.out.println(great[i].toString());*/
        break;
       }
    
        
        System.out.println("\n *** Program Finished *** ");
    }
    
    }

  12. #12
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,397
    Rep Power
    25

    Default

    I am having trouble using the divideAndRemainder()
    Please explain what the trouble is?

  13. #13
    mzjazzygirl is offline Member
    Join Date
    Sep 2010
    Posts
    16
    Rep Power
    0

    Default

    Hey Norm,

    I think I fixed that problem. I am trying to actually implement the divideAndRemainder() function.

    Again, I am working on a primitive CryptoSystem program (it's a homework assignment)

    I made some changes to my program. First, I looked at another post (under New to Java), dealing with changing chars to ints for ASCII purposes. Anyway, I noticed that the ASCII are in base 10. I need my code to work under base 128, so I changed the chars to ints, and multiplied the ints by 128.

    Next, with the divideAndRemainder() function, I am trying to use this in a loop. Basically, I want to keep dividing by the base (in this case 128) until the remainder is 0 (which means i'm at the end of division, nothing else to divide). I am having trouble using the divideAndRemainder() function. I can't find any examples on Google.

    When I run my program, and select 2 for Decryption, I get the following:

    Java Code:
    import java.io.*;
    import java.math.*;
    import java.util.*;
    
    public class Homework1 {
    static BigInteger[] great; 
    static BigInteger[] key;
    static char[] plaintext = new char[1000];
    static int count;
    static int count1;
    static int count2;
    static long base = 128;
    static BigInteger base2 = BigInteger.valueOf(base);
    
    public static BigInteger readKey() throws IOException
    {
      FileReader fr1 = new FileReader("key.txt");
      BufferedReader br1 = new BufferedReader(fr1);
      String line;
      count1 = 0;
     while((line = br1.readLine()) != null)
        {
          key[count1] = new BigInteger(line);
          //System.out.println("Line... " +line);
          count1++;
         }
         //System.out.println("Let's see... "+ key[0]);
        fr1.close();
    return key[0];
    }
    
    public static void readPlainText() throws IOException
    {
      FileReader fr2 = new FileReader("plaintext.txt");
      BufferedReader br2= new BufferedReader(fr2);
      String line1;
      String temp;
      int temp2[] = new int[10000];
      StringBuilder sb = new StringBuilder();
      BigInteger code;
    
      count2 = 0;
     while((line1 = br2.readLine()) != null)
        {
          line1.getChars(0, line1.length(), plaintext, 0);
          for(int k = 0; k < line1.length(); k++)
           {
            temp2[count2] = (int)plaintext[k] * 128;
            sb.append(temp2[count2]);
            count++;
           }
         }
        fr2.close();
       
        BigInteger temp3 = new BigInteger(sb.toString());
        code = temp3.multiply(key[0]);
        	
       try{
        PrintStream out = new PrintStream(new FileOutputStream("encryption.txt"));
        out.println(code);
        out.close();
       } catch (FileNotFoundException e) {
       e.printStackTrace();
     }
    }
    
    public static void readBigNumbers(BigInteger temp3) throws IOException
    { FileReader fr = new FileReader("encryption.txt");
      BufferedReader br = new BufferedReader(fr);
      
    
      String line;
      //System.out.println("New base from 128, to big integer... "+ base2);
      count = 0;
      while ((line = br.readLine()) != null)
          { great[count] = new BigInteger(line);
     	//System.out.println(great[count]);
            count++;
          }
      fr.close();
    
      System.out.println("Test 1... "+great[0]); //Encryption file
      System.out.println("Test 2... "+temp3); //Key
      
      BigInteger storage = new BigInteger(great[0].toString());
      BigInteger k_temp = new BigInteger(temp3.toString());
      //System.out.println("Prelim test..." +storage);
      //System.out.println("New prelim test..." +k_temp);
      
      BigInteger storage1[] = storage.divideAndRemainder(k_temp);
      
      System.out.println("Quotient... "+storage.divide(k_temp));
      /*System.out.println("Integral part... "+storage[1]);
      System.out.println("Remainder... "+storage[1]);*/
    
      
      
    }
    
    public static void main(String argv[])throws IOException
    {  great = new BigInteger[100];
       key = new BigInteger[5];
       String line;
       int selection = 0;
       BigInteger temp2;
    
        System.out.println("Please make your selection.\n 1. Encryption \n 2. Decryption\n");
        try{
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        line = in.readLine();
        selection = Integer.parseInt(line);
        }
        catch (IOException e) {
        System.out.println("Unexpected IO Error: " + e);
        }
        switch(selection) {
    
        case 1: 
        System.out.println("You have selected Encryption.");
        temp2 = readKey();
        readPlainText();
        System.out.println("The encryption.txt file has been created.");
        break;
    
        case 2:
        System.out.println("You have selected Decryption.");
        temp2 = readKey();
        readBigNumbers(temp2);
       /* System.out.println("\n Printing from great[] \n");
        for (int i = 0; i < count; i++)
           System.out.println(great[i].toString());*/
        break;
       }
    
        
        System.out.println("\n *** Program Finished *** ");
    }
    
    }

    Java Code:
    Please make your selection.
     1. Encryption
     2. Decryption
    
    2
    You have selected Decryption.
    Test 1... 2043609543318642661723365740481725931556904935551036645458759259730927
    3543083039960605160641280
    Test 2... 21574986861247560388341
    Quotient... 94721241614720139521344014080129284096947212416126721369614720142081
    4080
    
     *** Program Finished ***
    I hope this helps. Please help out where able.

    Thanks

  14. #14
    mzjazzygirl is offline Member
    Join Date
    Sep 2010
    Posts
    16
    Rep Power
    0

    Default

    Sorry,

    The output really doesn't help you...

    Java Code:
    Please make your selection.
     1. Encryption
     2. Decryption
    
    2
    You have selected Decryption.
    Encryption... 2043609543318642661723365740481725931556904935551036645458759259730927
    3543083039960605160641280
    Key... 21574986861247560388341
    Quotient... 94721241614720139521344014080129284096947212416126721369614720142081
    4080
    
     *** Program Finished ***
    How I received the quotient is by doing encryption/key. My next step is, I want to keep dividing (using the divideAndRemainder() function), and then changing the remainder from a number to a character.

    I hope THIS TIDBIT helps.

  15. #15
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,397
    Rep Power
    25

    Default

    Sorry, I do not understand most of what you posted or what your problem is.
    I can discuss the following:
    changing the remainder from a number to a character.
    Can you show how you want to change a number to a character?
    Characters have the same range in values as shorts. That is there are approximately 64K different character values. For example the character '1' has a value of 49.

    Please give me some examples, say two columns, one with the number and the other character.

  16. #16
    mzjazzygirl is offline Member
    Join Date
    Sep 2010
    Posts
    16
    Rep Power
    0

    Default

    OK, I printed this example:
    Please make your selection.
    1. Encryption
    2. Decryption

    1
    You have selected Encryption.
    Char: Number:
    J 74
    a 97
    s 115
    m 109
    i 105
    n 110
    e 101
    32
    J 74
    a 97
    c 99
    k 107
    s 115
    o 111
    n 110

    The encryption.txt file has been created.


    *** Program Finished ***

    Basically, I changed the chars to its ints equivalent, next, I multiplied each number by 128 (since my base is 128). And then I append the numbers together to create one big number (stored as a BigInteger) next, I multiplied this BigInteger by the cryptokey (this was given) --This is the encryption side

    Now, I am working on the decryption side, and I want to get back to my original message. What I am reading in is the BigInteger of the BigInteger * Key. Now I want to first divide by the key, and then continuously divide by 128 (since that's my base) until the remainder is 0 (which means that I have reached the left most letter).

    Like I said before, I could not find a divideAndRemainder() example on the web, and I am confused on how to use this function. I want to use the remainder (which is stored as a number) and change this to it's char equivalent (i'm assuming I can use the char cast to do this). I am just confused on how to continuously divide the new quotient and get the remainders.

    Does it make sense now?

  17. #17
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,397
    Rep Power
    25

    Default

    changing the remainder from a number to a character.
    but your list shows them in the order: char then number? What you show in the list requires no conversion other than casting. 'n' is 110. A space is 32
    i'm assuming I can use the char cast to do this
    Yes that is how to do it.

    I could not find a divideAndRemainder() example on the web
    Did you read the API doc for that method? It says what it does. Write a 10 line test program and get it to compile and execute. Use the Arrays.toString() method to display the results. Run the test with several different values and you'll see what it does.

  18. #18
    mzjazzygirl is offline Member
    Join Date
    Sep 2010
    Posts
    16
    Rep Power
    0

    Default

    Norm,

    The code output was a sample output of the digits without multiplying them by 128 and appending them to create one BigInteger. I will look for the API now.

  19. #19
    mzjazzygirl is offline Member
    Join Date
    Sep 2010
    Posts
    16
    Rep Power
    0

    Default

    Where exactly should I go to, looking for this API? Currently I am at the Java SE Tutorials... I think I am in the wrong spot.

  20. #20
    mzjazzygirl is offline Member
    Join Date
    Sep 2010
    Posts
    16
    Rep Power
    0

    Default

    Norm,

    Looked at the API, and I think I know what i'm doing. But I am getting the following error:

    Homework1.java:92: incomparable types: java.math.BigInteger and int
    while(storage2[1] != 0)
    ^
    1 error

    What I am trying to do is while the remainder does not equal zero then keep dividing by the base.

    Below is the full code.
    Java Code:
    import java.io.*;
    import java.math.*;
    import java.util.*;
    
    public class Homework1 {
    static BigInteger[] great; 
    static BigInteger[] key;
    static char[] plaintext = new char[1000];
    static int count;
    static int count1;
    static int count2;
    static long base = 128;
    static BigInteger base2 = BigInteger.valueOf(base);
    
    public static BigInteger readKey() throws IOException
    {
      FileReader fr1 = new FileReader("key.txt");
      BufferedReader br1 = new BufferedReader(fr1);
      String line;
      count1 = 0;
     while((line = br1.readLine()) != null)
        {
          key[count1] = new BigInteger(line);
          //System.out.println("Line... " +line);
          count1++;
         }
         //System.out.println("Let's see... "+ key[0]);
        fr1.close();
    return key[0];
    }
    
    public static void readPlainText() throws IOException
    {
      FileReader fr2 = new FileReader("plaintext.txt");
      BufferedReader br2= new BufferedReader(fr2);
      String line1;
      String temp;
      int temp2[] = new int[10000];
      StringBuilder sb = new StringBuilder();
      BigInteger code;
    
      count2 = 0;
     while((line1 = br2.readLine()) != null)
        {
          line1.getChars(0, line1.length(), plaintext, 0);
          for(int k = 0; k < line1.length(); k++)
           {
            temp2[count2] = (int)plaintext[k] * 128;        
            sb.append(temp2[count2]);
            count++;
           }
         }
        fr2.close();
       
        BigInteger temp3 = new BigInteger(sb.toString());
        code = temp3.multiply(key[0]);
        	
       try{
        PrintStream out = new PrintStream(new FileOutputStream("encryption.txt"));
        out.println(code);
        out.close();
       } catch (FileNotFoundException e) {
       e.printStackTrace();
     }
    }
    
    public static void readBigNumbers(BigInteger temp3) throws IOException
    { FileReader fr = new FileReader("encryption.txt");
      BufferedReader br = new BufferedReader(fr);
      
    
      String line;
      //System.out.println("New base from 128, to big integer... "+ base2);
      count = 0;
      while ((line = br.readLine()) != null)
          { great[count] = new BigInteger(line);
     	//System.out.println(great[count]);
            count++;
          }
      fr.close();
    
      System.out.println("Test 1... "+great[0]); //Encryption file
      System.out.println("Test 2... "+temp3); //Key
      
      BigInteger storage = new BigInteger(great[0].toString());
      BigInteger k_temp = new BigInteger(temp3.toString());
      //System.out.println("Prelim test..." +storage);
      //System.out.println("New prelim test..." +k_temp);
      
      BigInteger storage1[] = storage.divideAndRemainder(k_temp);
      BigInteger storage2[] = storage1[0].divideAndRemainder(base2);
      while(storage2[1] != 0)
      {
      System.out.println(storage2[1].toString());
    
      storage1[0].divideAndRemainder(base2);
      }
      
      System.out.println("Quotient... "+storage.divide(k_temp));
      /*System.out.println("Integral part... "+storage[1]);
      System.out.println("Remainder... "+storage[1]);*/
    
      
      
    }
    
    public static void main(String argv[])throws IOException
    {  great = new BigInteger[100];
       key = new BigInteger[5];
       String line;
       int selection = 0;
       BigInteger temp2;
    
        System.out.println("Please make your selection.\n 1. Encryption \n 2. Decryption\n");
        try{
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        line = in.readLine();
        selection = Integer.parseInt(line);
        }
        catch (IOException e) {
        System.out.println("Unexpected IO Error: " + e);
        }
        switch(selection) {
    
        case 1: 
        System.out.println("You have selected Encryption.");
        temp2 = readKey();
        readPlainText();
        System.out.println("The encryption.txt file has been created.");
        break;
    
        case 2:
        System.out.println("You have selected Decryption.");
        temp2 = readKey();
        readBigNumbers(temp2);
       /* System.out.println("\n Printing from great[] \n");
        for (int i = 0; i < count; i++)
           System.out.println(great[i].toString());*/
        break;
       }
    
        
        System.out.println("\n *** Program Finished *** ");
    }
    
    }
    Can you tell me why I am getting this error... I don't understand. How else am I supposed to check for the zero remainder if I can't use the does not equal (!=)

Page 1 of 2 12 LastLast

Similar Threads

  1. BigInteger
    By windows.login in forum New To Java
    Replies: 8
    Last Post: 07-13-2010, 01:10 PM
  2. convert unsigned integer to signed integer in java?
    By diskhub in forum New To Java
    Replies: 6
    Last Post: 05-17-2010, 12:50 AM
  3. My own BigInteger class. Need help.
    By Dinde in forum New To Java
    Replies: 2
    Last Post: 01-27-2010, 08:49 PM
  4. Replies: 24
    Last Post: 05-18-2009, 10:23 AM
  5. how to convert from BigInteger to Hex
    By nanaji in forum Advanced Java
    Replies: 10
    Last Post: 05-22-2008, 12: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
  •