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 6828095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:20:35+00:00 2026-05-26T22:20:35+00:00

Please help me to solve this: I have two strings for email-id and password

  • 0

Please help me to solve this:

I have two strings for email-id and password like

String name = "xyz@gmail.com";
String pass = "abc";

I encode these two into Base64 string like

String encoded_name = new String(Base64.encode(name.getBytes(), 0));
String encoded_pass = new String(Base64.encode(pass.getBytes(), 0));

and I need to concatenate these two encoded strings with space like

String merge = encoded_name + " " + encoded_pass;

I checked this string in console by

System.out.print("Concatenate string= " + merge);

but in console I am getting result in two lines like this

11-18 00:25:29.898: INFO/System.out(1244): Merge= eHl6QGdtYWlsLmNvbQ==
11-18 00:25:29.908: INFO/System.out(1244):  YWJj

Why is this happing the result is unexpected for me why it is not printing in a single line. please help me to solve this.

Thanks

  • 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-26T22:20:35+00:00Added an answer on May 26, 2026 at 10:20 pm

    You should use the NO_WRAP flag as described in the Docs, the Base64 class will not add additional newlines.

    NO_WRAP: Encoder flag bit to omit all line terminators (i.e., the output will be on one long line).

    So change your lines to the following:

    String encoded_name = new String(Base64.encode(name.getBytes(), Base64.NO_WRAP));
    String encoded_pass = new String(Base64.encode(pass.getBytes(), Base64.NO_WRAP));
    

    This will output the following:

    11-17 19:16:51.283: INFO/System.out(354): Concatenate string= eHl6QGdtYWlsLmNvbQ== YWJj
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a long string, ex: Please help me to solve this problem. This
please help me solve this issue. I have a client using WCF. I don't
I have a problem and I couldn't solve it.please help me. I have two
I have a string like Employee Name is Jason Taylor I need a regular
I have an object that looks like this. List<List<string>> MyData; The inner List<string> can
Please help! Background info I have a WPF application which accesses a SQL Server
Please help me convert this line to C#. objManagementBaseObject.SetPropertyValue(hDefKey, CType(&H & Hex(RegistryHive.LocalMachine), Long)) Related
I have little problem with printing data like this, I have written script like
HELP! I just setup a virtual host for two sites that have a lot
can you help me to solve this problem. im using PHP and MySQL. i

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.