1 55 package org.jboss.axis.types; 56 57 import org.jboss.axis.utils.Messages; 58 59 import java.math.BigInteger ; 60 import java.util.Random ; 61 62 68 public class NonNegativeInteger extends BigInteger 69 { 70 71 public NonNegativeInteger(byte[] val) 72 { 73 super(val); 74 checkValidity(); 75 } 77 public NonNegativeInteger(int signum, byte[] magnitude) 78 { 79 super(signum, magnitude); 80 checkValidity(); 81 } 83 public NonNegativeInteger(int bitLength, int certainty, Random rnd) 84 { 85 super(bitLength, certainty, rnd); 86 checkValidity(); 87 } 89 public NonNegativeInteger(int numBits, Random rnd) 90 { 91 super(numBits, rnd); 92 checkValidity(); 93 } 95 public NonNegativeInteger(String val) 96 { 97 super(val); 98 checkValidity(); 99 } 100 101 public NonNegativeInteger(String val, int radix) 102 { 103 super(val, radix); 104 checkValidity(); 105 } 107 110 private BigInteger zero = new BigInteger ("0"); 111 112 private void checkValidity() 113 { 114 if (compareTo(zero) < 0) 115 { 116 throw new NumberFormatException (Messages.getMessage("badNonNegInt00") 117 + ": " + this); 118 } 119 } 121 } | Popular Tags |