MCPcopy Create free account
hub / github.com/ReadyTalk/avian / Integer

Class Integer

classpath/java/lang/Integer.java:13–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11package java.lang;
12
13public final class Integer extends Number implements Comparable<Integer> {
14 public static final Class TYPE = avian.Classes.forCanonicalName("I");
15
16 public static final int MIN_VALUE = 0x80000000;
17 public static final int MAX_VALUE = 0x7FFFFFFF;
18
19 private final int value;
20
21 public Integer(int value) {
22 this.value = value;
23 }
24
25 public Integer(String s) {
26 this.value = parseInt(s);
27 }
28
29 public static Integer valueOf(int value) {
30 return new Integer(value);
31 }
32
33 public static Integer valueOf(String value) {
34 return valueOf(parseInt(value));
35 }
36
37 public boolean equals(Object o) {
38 return o instanceof Integer && ((Integer) o).value == value;
39 }
40
41 public int hashCode() {
42 return value;
43 }
44
45 public int compareTo(Integer other) {
46 return value - other.value;
47 }
48
49 public String toString() {
50 return toString(value);
51 }
52
53 public static String toString(int v, int radix) {
54 return Long.toString(v, radix);
55 }
56
57 public static String toString(int v) {
58 return toString(v, 10);
59 }
60
61 public static String toHexString(int v) {
62 return Long.toString(((long) v) & 0xFFFFFFFFL, 16);
63 }
64
65 public static String toOctalString(int v) {
66 return Long.toString(((long) v) & 0xFFFFFFFFL, 8);
67 }
68
69 public static String toBinaryString(int v) {
70 return Long.toString(((long) v) & 0xFFFFFFFFL, 2);

Callers

nothing calls this directly

Calls 1

forCanonicalNameMethod · 0.80

Tested by

no test coverage detected