2 * Back 2 Browser Bytecode Translator
3 * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, version 2 of the License.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. Look for COPYING file in the top folder.
16 * If not, see http://opensource.org/licenses/GPL-2.0.
18 package org.apidesign.vm4brwsr;
20 import java.io.ByteArrayInputStream;
21 import java.io.DataInputStream;
22 import java.io.IOException;
26 * @author Jaroslav Tulach <jtulach@netbeans.org>
28 public class Numbers {
29 private static Double autoboxDbl() {
32 public static String autoboxDblToString() {
33 return autoboxDbl().toString().toString();
35 public static int rem(int a, int b) {
39 static float deserFloat() throws IOException {
40 byte[] arr = {(byte) 71, (byte) 84, (byte) 52, (byte) 83};
41 ByteArrayInputStream is = new ByteArrayInputStream(arr);
42 DataInputStream dis = new DataInputStream(is);
43 float r = dis.readFloat();
46 static double deserDouble() throws IOException {
47 byte[] arr = {(byte)64, (byte)8, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0};
48 ByteArrayInputStream is = new ByteArrayInputStream(arr);
49 DataInputStream dis = new DataInputStream(is);
50 return dis.readDouble();
52 static long deserLong(byte[] arr) throws IOException {
53 ByteArrayInputStream is = new ByteArrayInputStream(arr);
54 DataInputStream dis = new DataInputStream(is);
55 return dis.readLong();
57 static int deserInt() throws IOException {
58 byte[] arr = {(byte) 71, (byte) 84, (byte) 52, (byte) 83};
59 ByteArrayInputStream is = new ByteArrayInputStream(arr);
60 DataInputStream dis = new DataInputStream(is);
64 static String intToString() {
65 return new Integer(5).toString().toString();
67 static String floatToString() {
68 return new Float(7.0).toString().toString();