Package thread.exercises.exercise1

Examples of thread.exercises.exercise1.Exercise1


    int hi = 1;
    String mark;
    FibonacciElement[] elements = new FibonacciElement[MAX_INDEX];
   
    for(int i = 0; i < MAX_INDEX; i++) {
      elements[i] = new FibonacciElement(hi);
      hi = lo + hi;
      lo = hi - lo;
    }
   
    String[] outputWords = new String[MAX_INDEX];
    for(int i = 0; i < MAX_INDEX; i++) {
      FibonacciElement element = elements[i];
      if(element.isEven()) {
        mark = " *";
      } else {
        mark = "";
      }
      outputWords[i] = i + 1 + ": " + element.getNumber() + mark;
    }
   
    for(String word : outputWords) {
      System.out.printf("%s%n", word);
    }
View Full Code Here


    int hi = 1;
    String mark;
    FibonacciElement[] elements = new FibonacciElement[MAX_INDEX];
   
    for(int i = 0; i < MAX_INDEX; i++) {
      elements[i] = new FibonacciElement(hi);
      hi = lo + hi;
      lo = hi - lo;
    }
   
    String[] outputWords = new String[MAX_INDEX];
    for(int i = 0; i < MAX_INDEX; i++) {
      FibonacciElement element = elements[i];
      if(element.isEven()) {
        mark = " *";
      } else {
        mark = "";
      }
      outputWords[i] = i + 1 + ": " + element.getNumber() + mark;
    }
   
    for(String word : outputWords) {
      System.out.println(word);
    }
View Full Code Here

TOP

Related Classes of thread.exercises.exercise1.Exercise1

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.