author | mseledtsov |
Wed, 16 May 2018 16:43:11 -0700 | |
changeset 50154 | d2d6bc39ea88 |
permissions | -rw-r--r-- |
50154
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
1 |
/* |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
2 |
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
4 |
* |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
8 |
* |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
13 |
* accompanied this code). |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
14 |
* |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
18 |
* |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
21 |
* questions. |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
22 |
*/ |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
23 |
|
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
24 |
package nsk.sysdict.share; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
25 |
|
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
26 |
import java.io.*; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
27 |
|
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
28 |
/** |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
29 |
* This tools generates a chain of classes. |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
30 |
* For more details, use: |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
31 |
* <pre> |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
32 |
* java ChainGen -help |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
33 |
* </pre> |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
34 |
*/ |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
35 |
public class ChainGen { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
36 |
private static final int FATS_HEIGHT = 5; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
37 |
private static final int FATS_WEIGHT = 10000; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
38 |
private static final int LEANS_HEIGHT = 50; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
39 |
private static final int LEANS_WEIGHT = 1; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
40 |
|
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
41 |
private static void explain(Object x) { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
42 |
System.err.println("# " + x); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
43 |
} |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
44 |
|
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
45 |
public static void main(String args[]) { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
46 |
if (args.length < 1 || args[0].toLowerCase().startsWith("-h")) { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
47 |
explain("Generates a chain classes extending each other."); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
48 |
explain(""); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
49 |
explain("Use:"); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
50 |
explain(" java ChainGen $NAME $HEIGHT $WEIGHT"); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
51 |
explain("Or:"); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
52 |
explain(" java ChainGen \"fats\""); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
53 |
explain("Or:"); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
54 |
explain(" java ChainGen \"leans\""); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
55 |
explain(""); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
56 |
explain("This creates:"); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
57 |
explain(" ${NAME}Info.java class displaying HEIGHT and WEIGHT."); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
58 |
explain(" ${NAME}XXXXXX.java defining classes chain."); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
59 |
explain(""); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
60 |
explain("Here:"); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
61 |
explain(" HEIGHT and WEIGHT must be positive integers."); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
62 |
explain(" Defaults for \"fats\": HEIGHT is " + FATS_HEIGHT |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
63 |
+ ", WEIGHT is " + FATS_WEIGHT +"."); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
64 |
explain(" Defaults for \"leans\": HEIGHT is " + LEANS_HEIGHT |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
65 |
+ ", WEIGHT is " + LEANS_WEIGHT +"."); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
66 |
System.exit(1); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
67 |
}; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
68 |
String name; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
69 |
int height, weight; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
70 |
if (args[0].toLowerCase().equals("fats")) { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
71 |
name = "Fats"; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
72 |
height = FATS_HEIGHT; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
73 |
weight = FATS_WEIGHT; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
74 |
} else if (args[0].toLowerCase().equals("leans")) { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
75 |
name = "Leans"; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
76 |
height = LEANS_HEIGHT; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
77 |
weight = LEANS_WEIGHT; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
78 |
} else { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
79 |
name = args[0]; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
80 |
height = Integer.parseInt(args[1]); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
81 |
weight = Integer.parseInt(args[2]); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
82 |
}; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
83 |
try { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
84 |
doit(name, height, weight); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
85 |
} catch (IOException exception) { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
86 |
exception.printStackTrace(System.err); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
87 |
System.exit(1); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
88 |
} |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
89 |
} |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
90 |
|
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
91 |
private static void doit(String name, int height, int weight) |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
92 |
throws FileNotFoundException |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
93 |
{ |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
94 |
// Constants definition: |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
95 |
PrintStream info = new PrintStream( |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
96 |
new FileOutputStream(new File(name + "Info.java")) |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
97 |
); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
98 |
info.println("// This file is generated by: ChainGen.java"); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
99 |
info.println("package nsk.sysdict.share;"); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
100 |
info.println("public class " + name + "Info {"); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
101 |
info.println(" public static final int HEIGHT = " + height + ";"); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
102 |
info.println(" private static final int WEIGHT = " + weight + ";"); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
103 |
info.println(" public static final String rootName = \"" + name + "\";"); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
104 |
info.println(" public static final String[] nodeNames = new String[] {"); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
105 |
// Generate a series of fat classes: |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
106 |
for (int index=0; index<height; index++) { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
107 |
String suffix = digits(index,6); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
108 |
String className = name + suffix; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
109 |
info.println(" \"" + suffix + "\"" |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
110 |
+ (index+1<height? "," : "")); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
111 |
PrintStream chain = new PrintStream( |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
112 |
new FileOutputStream(new File(className + ".java")) |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
113 |
); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
114 |
chain.println("// This file is generated by: ChainGen.java"); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
115 |
chain.println("package nsk.sysdict.share;"); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
116 |
chain.println("class " + className |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
117 |
+ (index>0? " extends " + name + digits(index-1,6): "") |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
118 |
+ " {"); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
119 |
for (int w=0; w<weight; w++) { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
120 |
String fieldName = "fill_" + className + "_" + digits(w,6); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
121 |
chain.println(" static long " + fieldName + ";"); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
122 |
} |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
123 |
chain.println("}"); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
124 |
chain.close(); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
125 |
}; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
126 |
// |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
127 |
info.println(" };"); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
128 |
info.println("}"); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
129 |
info.close(); |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
130 |
} |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
131 |
|
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
132 |
/** |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
133 |
* Convert <tt>x</tt> to <tt>n</tt>-digits string. |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
134 |
*/ |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
135 |
private static String digits(int x, int n) { |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
136 |
String s = "" + x; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
137 |
while (s.length() < n) |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
138 |
s = "0" + s; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
139 |
return s; |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
140 |
} |
d2d6bc39ea88
8199252: [TESTBUG] Open source VM testbase system dictionary tests
mseledtsov
parents:
diff
changeset
|
141 |
} |