Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7588781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:00:31+00:00 2026-05-30T20:00:31+00:00

I found an answer that almost solves my problem: https://stackoverflow.com/a/5717191/1065546 This answer demonstrates how

  • 0

I found an answer that almost solves my problem:
https://stackoverflow.com/a/5717191/1065546

This answer demonstrates how to encode a BigInteger into a String then back into a BigInteger using Base64 encodings which uses Apache commons-codec.

Is there a way of encoding technique/method for a String to a BigInteger then back to a String?
if so would someone please explain how to use it?

      String s = "hello world";
      System.out.println(s);

      BigInteger encoded = new BigInteger( SOME ENCODING.(s));
      System.out.println(encoded);

      String decoded = new String(SOME DECODING.(encoded));
      System.out.println(decoded);

Print:

      hello world
      830750578058989483904581244
      hello world

(The output is just an example and hello world doesn’t have to decode to that BigInteger)

EDIT

More specific:

I am writing a RSA algorithm and I need to convert a message into a BigInteger so that I can then encrypt the message with the public key (send message) and then decrypt the message with the private key and then convert the number back into a String.

I would like a method of conversion that could produce the smallest BigInteger as I was planning on using binary until I realised how ridiculouslybig the number would be.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T20:00:32+00:00Added an answer on May 30, 2026 at 8:00 pm

    I don’t understand why you want to go through complicated methods, BigInteger already is compatible with String :

    // test string
    String text = "Hello world!";
    System.out.println("Test string = " + text);
    
    // convert to big integer
    BigInteger bigInt = new BigInteger(text.getBytes());
    System.out.println(bigInt.toString());
    
    // convert back
    String textBack = new String(bigInt.toByteArray());
    System.out.println("And back = " + textBack);
    

    ** Edit **

    But why do you need BigInteger while you can work directly with the bytes, like DNA said?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is a hum-dinger of a problem that I have not found an answer
While trying to answer this question I found that the code int* p =
I found this answer and it sounds like almost exactly what I'm doing. I
I almost found the answer to this question in this thread (samplebias's answer); however
I found the following answer to that question: A service opens before you even
I haven't found an answer to this particular question; perhaps there isn't one. But
I've found a answer how to remove diacritic characters on stackoverflow, but could you
I haven't exactly found the answer to this, maybe there is no best one.
EDIT: I finally found a real simple solution to this problem, using the CAGradientLayer
Often, when searching for answers, I have found that certain websites will allow you

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.