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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:50:32+00:00 2026-06-09T22:50:32+00:00

I have the following java method, written for an android application. private String removeWifiFudge(String

  • 0

I have the following java method, written for an android application.

private String removeWifiFudge(String message, String removedFudge)
{
    int find1 = 255;   //FF
    int find2 = 0;     //00
    int find3 = 204;   //CC
    int find4 = 36;    //24

    char[] charMessage = message.toCharArray();

    boolean find1True = false;

    for (char eachCharacter : charMessage)
    {
        if (find1True)
        {
            if ((int) eachCharacter == find2)
            {
                removedFudge = removedFudge + String.valueOf((char)find1);
            }
            else
            {
                if ((int) eachCharacter == find3)
                {
                    removedFudge = removedFudge + String.valueOf((char)find4);
                }
                else
                {
                    removedFudge = removedFudge + String.valueOf((char)find1);

                    removedFudge = removedFudge + String.valueOf(eachCharacter);
                }
            }

            find1True = false;
        }
        else 
        {
            if ((int) eachCharacter == find1)
            {
                find1True = true;
            }
            else
            {
                removedFudge = removedFudge + String.valueOf(eachCharacter);
            }
        }
    }   

    return removedFudge;
}

In a nutshell, it takes a string, message and searches it character by character for instances of 0xFF00 and 0xFFCC. On finding these instances, it replaces them by 0xFF and 0x24 respectively, putting it in a new string removedFudge.

This method is taking up a massive percentage of the CPU time and whilst using the java profiler embedded in eclipse, DDMS, it informed me 53% of the method time is spent:

java/lang/StringBuilder. (Ljava/lang/String;)V

This seems to be saying it is taking up the time initialising a string, however as I am passing it the already initialised string to put the new message in, I can’t see where the initialising String is coming from.

Anyone an expert on DDMS?

  • 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-09T22:50:33+00:00Added an answer on June 9, 2026 at 10:50 pm

    String concatenation results in using a StringBuilder at runtime and so it’s appearing in your profiler.

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

Sidebar

Related Questions

I have a general Java method with the following method signature: private static ResultSet
I have a method that contains the following (Java) code: doSomeThings(); doSomeOtherThings(); doSomeThings() creates
If I have the following Java code: int[][] readAPuzzle() { Scanner input = new
Say I have the following simple java bean: class MyBean { private Date startDate;
I have written following code to get location name package demo.gps.locname; import java.io.IOException; import
I have written following code for getting location name : UseGpsActivity.java public class UseGpsActivity
I'm just learning java and following a book. I have a program written via
i have written a following hbase client class for remote server: System.out.println(Hbase Demo Application
I've made the following method: static int GenerateSeccondPal(int x){ String y = Integer.toString(x); char[]
I'm trying to convert a method that I have written in C# to Java

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.