Solved

how can I test this some help please

Posted on 2004-03-26
8
168 Views
Last Modified: 2010-03-31
how can I test this some help please

static void printRows() {
    final int INDEX_LIMIT = 8;
          final int BATCH_LENGTH_LIMIT = 8;
    final int BATCH_SIZE = 4;
    final int NUM_BATCH_GROUPS = 4;
    int batchLength = 4;
          // Disallow duplicates by using a Set
    Set numbers = new HashSet();
    for (int batchGroup = 0; batchGroup < NUM_BATCH_GROUPS; batchGroup++) {
               // Add numbers if more needed
      while (numbers.size() < batchLength && batchLength < BATCH_LENGTH_LIMIT) {
        numbers.add(new Integer((int)(Math.random()  * INDEX_LIMIT) + 1));
      }
      for (int batchSize = 0; batchSize < BATCH_SIZE; batchSize++) {
        java.util.List list = new ArrayList(numbers);
                    // Shuffle and print
        Collections.shuffle(list);
        System.out.println(list);
      }
      batchLength++;
      System.out.println();
    }
  }
0
Comment
Question by:Drop_of_Rain
  • 5
  • 3
8 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 150 total points
ID: 10689938
You could have asked me that before!

public class TestIt {
    public static void main(String[] args) {
        printRows();
   }

// paste the other cod ein here

}
0
 

Author Comment

by:Drop_of_Rain
ID: 10689971
I'm sorry I get micro focused
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10689990
LOL ;-)
0
 

Author Comment

by:Drop_of_Rain
ID: 10691631
It says incannot resolve symbol class set
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Author Comment

by:Drop_of_Rain
ID: 10691636
public class TestIt {
    public static void main(String[] args) {
        printRows();
   }

// paste the other cod in here

static void printRows() {
    final int INDEX_LIMIT = 8;
          final int BATCH_LENGTH_LIMIT = 8;
    final int BATCH_SIZE = 4;
    final int NUM_BATCH_GROUPS = 4;
    int batchLength = 4;
          // Disallow duplicates by using a Set
    Set numbers = new HashSet();
    for (int batchGroup = 0; batchGroup < NUM_BATCH_GROUPS; batchGroup++) {
               // Add numbers if more needed
      while (numbers.size() < batchLength && batchLength < BATCH_LENGTH_LIMIT) {
        numbers.add(new Integer((int)(Math.random()  * INDEX_LIMIT) + 1));
      }
      for (int batchSize = 0; batchSize < BATCH_SIZE; batchSize++) {
        java.util.List list = new ArrayList(numbers);
                    // Shuffle and print
        Collections.shuffle(list);
        System.out.println(list);
      }
      batchLength++;
      System.out.println();
    }
  }  
}
0
 

Author Comment

by:Drop_of_Rain
ID: 10691682
I got it there were no imports
0
 

Author Comment

by:Drop_of_Rain
ID: 10691705
I would need the numbers to start off with lower numbers and work its way up with the adding of numbers?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10695188
:-)

Your new version is ready for you btw - i just posted it ;-)
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now