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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:41:27+00:00 2026-06-05T01:41:27+00:00

private static String getArgValue(String[] argsString, int[] jIndex, String classTag) { String thisToken; for( ;

  • 0
private static String getArgValue(String[] argsString, int[] jIndex, String classTag) {

    String thisToken;

    for( ; jIndex[0]<argsString.length ; jIndex[0]++) {
        System.out.println("jIndex[0]: " + jIndex[0]);

        if (condition) {
            // yadda yadda yadda
            jIndex[0]++;
            System.out.println("jIndex[0]: " + jIndex[0]);
            return retString;
        }
    }

    return retString;
}

I’ve tried wrapping it both with Integer and with an array, but neither have made changes to the original i variable. How it is called:

int[] j = new int[1];

for(int i=2; i< argsString.length; i++) {
    // yadda yadda yadda
    System.out.println("opening i: " + i);
    j[0] = i;

    thisArgValueString = getArgValue(argsString, j, thisArgClassString);
    System.out.println("closing i: " + i);
}

Example output:

opening i: 2
jIndex[0]: 2
jIndex[0]: 3
jIndex[0]: 5
closing i: 2
  • 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-05T01:41:28+00:00Added an answer on June 5, 2026 at 1:41 am

    Try printing your int holder and not i itself:

    System.out.println("closing i: " + j[0]);
    

    Or you can simply reassign i:

    i = j[0];
    System.out.println("closing i: " + i);
    

    Your original varialbe i will not change by itself as it is a primitive type. Integer is also not useful as it is immutable. So the code you provided is essentially the correct approach. You just have to understand, that j[0] = i only assigns the value of i to j[0] and does not link the content of j[0] to i. So you could just work with j[0] from that point on (like the first code in this post) or reassign i back from j[0] (like the second code in this post).

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

Sidebar

Related Questions

Is there a way to improve this: private static int CountNewlines(string s) { int
Can't seem to figure out where Im going wrong here: private static String generateHashFromFile(String
This is my code: private static string AddURISlash(string remotePath) { if (remotePath.LastIndexOf(/) != remotePath.Length
I have a ConcurrentDictionary: private static ConcurrentDictionary<int, string> _cd = new ConcurrentDictionary<int, string>(); To
I have a method lets say: private static String drawCellValue( int maxCellLength, String cellValue,
I want to compute salt for aspnet Membership. private static string CreateSalt(int size){ But
public class Readparam { private static String method_name; public static HashMap<String, Vector<String>> getParameters(String file_name)
I have the C# method private static string TypeNameLower(object o) { return o.GetType().Name.ToLower(); }
I'm trying to dynamically create a connection string during compile time: private static string
Consider this sample class, class TargetClass { private static String SENSITIVE_DATA = sw0rdfish; private

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.