Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. public class NumberDisplay
  2. {
  3.     private int limit;
  4.     private int value;
  5.    
  6.     public NumberDisplay(int rollOverLimit)
  7.     {
  8.         limit = rollOverLimit;
  9.         value = 0;
  10.     }
  11.  
  12.     public int getValue()
  13.     {
  14.         return value;
  15.     }
  16.    
  17.     public void setValue(int replacementValue)
  18.     {
  19.         if((replacementValue >= 0) &&
  20.                 (replacementValue < limit)) {
  21.                     value = replacementValue;
  22.                 }
  23.     }
  24.    
  25.     public String getDisplayValue()
  26.     {
  27.         if(value < 10) {
  28.             return "0" +value ;
  29.         }
  30.         else {
  31.             return "" +value ;
  32.         }
  33.     }
  34.    
  35.     public void increment()
  36.     {
  37.         value = (value + 1) % limit;
  38.     }
  39. }