Don't like ads? PRO users don't see any ads ;-)
Guest

JavaDoc

By: a guest on May 22nd, 2012  |  syntax: Java  |  size: 1.11 KB  |  hits: 20  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5. package javadoc;
  6.  
  7. /**
  8.  * Test-Beispiele zur <b>Konsolen-Ausgabe</b> in Java.
  9.  *
  10.  * @version V1.0.0 (14.02.2003)
  11.  * @author NickThommen, Copyright by softEnvironent
  12.  */
  13.  
  14. public class ConsoleDemoJavaDoc {
  15.  
  16.     /**
  17.      * @param args the command line arguments
  18.      */
  19.     public static void main(String[] args) {
  20.         // TODO code application logic here
  21.     }
  22.    
  23.     /**
  24.  *      Die Funktion liefert eine <b>Zufallszahl</b> zwischen 0 und max.
  25.  *    
  26.  *    Fehler werden abgefangen. Unter Umstaenden muss der Generator
  27.  *    initialisiert werden.    
  28.  *    
  29.  *      @param max Grösstmögliche, gewünschte Zufallszahl
  30.  *      @see java.util.Random
  31.  *      @return berechnete Zufallszahl
  32.  *      @exception NumberformatException
  33.  */
  34.  
  35.    
  36.     public static int getRandomNumber(int max) throws NumberFormatException {
  37.         if (max < 0) {
  38.                 throw new NumberFormatException("max muss >= 0 sein!");
  39.         }
  40.         java.util.Random generator = new java.util.Random();
  41.         return generator.nextInt(max); // zwischen 0..max
  42.  }
  43.  
  44.  
  45. }