01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: package java.lang;
19:
20: /**
21: * Number is the abstract superclass of the classes which represent numeric base
22: * types (i.e. all but Character, Boolean, and Void).
23: */
24: public abstract class Number implements java.io.Serializable {
25:
26: private static final long serialVersionUID = -8742448824652078965L;
27:
28: /**
29: * Number constructor. Included for spec compatability.
30: */
31: public Number() {
32: }
33:
34: /**
35: * Answers the byte value which the receiver represents
36: *
37: * @return byte the value of the receiver.
38: */
39: public byte byteValue() {
40: return (byte) intValue();
41: }
42:
43: /**
44: * Answers the double value which the receiver represents
45: *
46: * @return double the value of the receiver.
47: */
48: public abstract double doubleValue();
49:
50: /**
51: * Answers the float value which the receiver represents
52: *
53: * @return float the value of the receiver.
54: */
55: public abstract float floatValue();
56:
57: /**
58: * Answers the int value which the receiver represents
59: *
60: * @return int the value of the receiver.
61: */
62: public abstract int intValue();
63:
64: /**
65: * Answers the long value which the receiver represents
66: *
67: * @return long the value of the receiver.
68: */
69: public abstract long longValue();
70:
71: /**
72: * Answers the short value which the receiver represents
73: *
74: * @return short the value of the receiver.
75: */
76: public short shortValue() {
77: return (short) intValue();
78: }
79: }
|