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

  • Home
  • SEARCH
  • 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 7446287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T12:16:42+00:00 2026-05-29T12:16:42+00:00

I am new to Java and trying to write a program.. here is the

  • 0

I am new to Java and trying to write a program..
here is the code. In the function reduce when count = 14, the program gets stuck…Plz let me know what am i doing wrong..

public static class MerkleReducer extends MapReduceBase
implements Reducer<LongWritable, Text, LongWritable, Text> {

 static String[][] sarray = new String[5][14];
  static int count = 0;

 private void MerkleReducer() {
   for (int i=0;i<5;i++)
      for (int j=0; j<14;j++)
            sarray[i][j] += "";
 }

public void reduce(LongWritable key, Iterator<Text> values
  OutputCollector<LongWritable, Text> output, Reporter reporter) throws IOException {

    count++;
    Text hashval = new Text();
    while (values.hasNext()) {
           hashval = values.next();
    }
    sarray[0][(int)key.get()] += hashval.toString();
    if (count == 14) {
        for (int i=1; i<5; i++) { 
         for (int j=0; j<7; j = j++) { 
           int k = 2 * j;
           String hashv= new String();
           if ("".equals(sarray[i-1][k])) {
              break;
           }
           if ("".equals(sarray[i-1][k+1])) {
               sarray[i][j] = sarray[i-1][k];
               break;
           }
           hashv += sarray[i-1][k] + sarray[i-1][k+1];
           sarray[i][j] += hashv;

        }
       }
      output.collect(key, new Text(sarray[3][0]));

    } else {
        output.collect(key, new Text(hashval.toString()));
    }

}
}

  • 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-29T12:16:42+00:00Added an answer on May 29, 2026 at 12:16 pm

    j = j++ means j will never change, it will take the current value of j, increment j, then assign the old value back to j.

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

Sidebar

Related Questions

I am trying to write a program in Java using ExecutorService and its function
I'm new to java and trying to write a simple program using JDBC. It
Hey I'm new to java servlets and I am trying to write one that
I am new to Java and am trying to run a program using Eclipse.
I know something about Java but completely new to Enterprise Java. I'm trying my
I am trying to write a java program that will automatically download and name
I'm trying to write a file from my Java program, but nothing happens. I'm
Guys I'm a bit new in using java and i'm trying to write a
I am trying to write a watermarking program with java , So I found
I've been trying to write a program in java that can download a number

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.