01: /*
02: * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05: package com.sun.portal.desktop.util;
06:
07: public class Integers {
08: private static int SIZE = 10;
09: private static int HEXSIZE = 126;
10: static Integer[] integers = null;
11: static String[] hexInts = null;
12:
13: static {
14: integers = new Integer[SIZE];
15:
16: for (int i = 0; i < SIZE; i++) {
17: integers[i] = new Integer(i);
18: }
19:
20: hexInts = new String[HEXSIZE];
21: for (int i = 0; i < HEXSIZE; i++) {
22: hexInts[i] = Integer.toString(i, 16);
23: }
24:
25: }
26:
27: public static Integer get(int i) {
28: if ((i >= SIZE) || (i < 0)) {
29: return new Integer(i);
30: }
31:
32: return integers[i];
33: }
34:
35: public static String getHex(int i) {
36: if (i >= HEXSIZE) {
37: return Integer.toString(i, 16);
38: }
39:
40: return hexInts[i];
41: }
42:
43: }
|