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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T20:36:17+00:00 2026-06-07T20:36:17+00:00

In Java, working with binary strings (e.g. 00010010, zeroes are added in the beginning

  • 0

In Java, working with binary strings (e.g. “00010010”, zeroes are added in the beginning when creating these binary strings for the purpose of my program). I have the function

private static boolean isJinSuperSets(String J, List<String> superSets) {

    for (String superJ : superSets)
        if (superJ.equals(J)) return true;

    return false;
}

that checks if a binary string J is contained in the list of binary strings superSets.

I use equals() on the String object but I would like to speed up this code by converting binary strings to binary numbers and doing bitwise operation AND to see if they are equal.

Could you please give me a few tricks on how to accomplish that?

  • 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-06-07T20:36:19+00:00Added an answer on June 7, 2026 at 8:36 pm

    Here for int:

    for (String superJ : superSets)
            return Integer.valueOf(superJ,2) == Integer.valueOf(J,2);
    }
    

    You have to test with benchmarks (take care first time is always slower) for speed.

    The best way to optimize if J is more than once used : have J2 as Integer somewhere and test on it.

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

Sidebar

Related Questions

I have created a couple of java working sets for a project in my
how can i make java program working with multiple languages (frensh, english , arabic
When working with Java from Scala, we have to account for null. HttpServletRequest getters
I'm working with java, trying to use the AudioFormat Class. I have the following
I have a working java client that is communicating with Google, through ProtoBuf serialized
So I'm working on creating a visualization for a data structure in Java. I
I have binary ASN.1 data objects I need to parse into my Java project.
I am working on a project and have a question about Java sockets. The
I'm new to Java and working on a basic program that looks through an
I have the following Java code working with XPath to get data from XML

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.