charcvt.java
来自「kaffe Java 解释器语言,源码,Java的子集系统,开放源代码」· Java 代码 · 共 68 行
JAVA
68 行
import kaffe.io.ByteToCharIconv;import kaffe.io.CharToByteIconv;/** * this class tests some aspects of the conversion * between ints, shorts, and chars */public class CharCvt{ static void print_as_int(char x) { System.out.println((int)x); } static void print_as_int(short x) { System.out.println((int)x); } static char make_a_char(int x) { return (char)x; } static short make_a_short(int x) { return (short)x; } public static void main(String av[]) throws Throwable { print_as_int(make_a_char(-1)); print_as_int(make_a_short(-1)); /* Make sure CharToByteIconv does the right thing. */ try { CharToByteIconv ic; ic = new CharToByteIconv("SHIFT_JIS"); ic.convert(new char[0], 0, 0, new byte[0], 0, 0); } catch(java.io.UnsupportedEncodingException th) { } /* Make sure ByteToCharIconv does the right thing. */ try { ByteToCharIconv ic; ic = new ByteToCharIconv("SHIFT_JIS"); ic.convert(new byte[0], 0, 0, new char[0], 0, 0); } catch(java.io.UnsupportedEncodingException th) { } }}// unsafe/* Expected Output:65535-1*/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?