Solved

how can I test this some help please

Posted on 2004-03-26
8
174 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:Drop_of_Rain
ID: 10691631
It says incannot resolve symbol class set
0
 

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
java jdbc batch example 8 41
configure dependency in POM for new database 3 34
SHA2 certs for IIS AND Java? 2 113
jboss wildfly 10.1 10 228
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…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
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 …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

856 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