jaroslav@114
|
1 |
/**
|
jaroslav@114
|
2 |
* Back 2 Browser Bytecode Translator
|
jaroslav@114
|
3 |
* Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
|
jaroslav@114
|
4 |
*
|
jaroslav@114
|
5 |
* This program is free software: you can redistribute it and/or modify
|
jaroslav@114
|
6 |
* it under the terms of the GNU General Public License as published by
|
jaroslav@114
|
7 |
* the Free Software Foundation, version 2 of the License.
|
jaroslav@114
|
8 |
*
|
jaroslav@114
|
9 |
* This program is distributed in the hope that it will be useful,
|
jaroslav@114
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
jaroslav@114
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
jaroslav@114
|
12 |
* GNU General Public License for more details.
|
jaroslav@114
|
13 |
*
|
jaroslav@114
|
14 |
* You should have received a copy of the GNU General Public License
|
jaroslav@114
|
15 |
* along with this program. Look for COPYING file in the top folder.
|
jaroslav@114
|
16 |
* If not, see http://opensource.org/licenses/GPL-2.0.
|
jaroslav@114
|
17 |
*/
|
jaroslav@114
|
18 |
package org.apidesign.vm4brwsr;
|
jaroslav@114
|
19 |
|
jaroslav@181
|
20 |
import java.io.ByteArrayInputStream;
|
jaroslav@181
|
21 |
import java.io.DataInputStream;
|
jaroslav@181
|
22 |
import java.io.IOException;
|
jaroslav@181
|
23 |
|
jaroslav@114
|
24 |
/**
|
jaroslav@114
|
25 |
*
|
jaroslav@114
|
26 |
* @author Jaroslav Tulach <jtulach@netbeans.org>
|
jaroslav@114
|
27 |
*/
|
jaroslav@114
|
28 |
public class Numbers {
|
jaroslav@114
|
29 |
private static Double autoboxDbl() {
|
jaroslav@114
|
30 |
return 3.3;
|
jaroslav@114
|
31 |
}
|
jaroslav@114
|
32 |
public static String autoboxDblToString() {
|
jaroslav@114
|
33 |
return autoboxDbl().toString().toString();
|
jaroslav@114
|
34 |
}
|
jaroslav@178
|
35 |
public static int rem(int a, int b) {
|
jaroslav@178
|
36 |
return a % b;
|
jaroslav@178
|
37 |
}
|
jaroslav@181
|
38 |
|
jaroslav@181
|
39 |
static float deserFloat() throws IOException {
|
jaroslav@181
|
40 |
byte[] arr = {(byte) 71, (byte) 84, (byte) 52, (byte) 83};
|
jaroslav@181
|
41 |
ByteArrayInputStream is = new ByteArrayInputStream(arr);
|
jaroslav@181
|
42 |
DataInputStream dis = new DataInputStream(is);
|
jaroslav@181
|
43 |
float r = dis.readFloat();
|
jaroslav@181
|
44 |
return r;
|
jaroslav@181
|
45 |
}
|
jaroslav@181
|
46 |
static int deserInt() throws IOException {
|
jaroslav@181
|
47 |
byte[] arr = {(byte) 71, (byte) 84, (byte) 52, (byte) 83};
|
jaroslav@181
|
48 |
ByteArrayInputStream is = new ByteArrayInputStream(arr);
|
jaroslav@181
|
49 |
DataInputStream dis = new DataInputStream(is);
|
jaroslav@181
|
50 |
return dis.readInt();
|
jaroslav@181
|
51 |
}
|
jaroslav@181
|
52 |
|
jaroslav@114
|
53 |
}
|