inputtest.java
来自「加密算法」· Java 代码 · 共 102 行
JAVA
102 行
import javax.swing.*;
import java.math.*;
import java.nio.charset.spi.*;
import java.io.*;
public class InputTest
{
public static void main(String args[])
{
test a=new test();
}
}
class test
{
public test()
{
name=JOptionPane.showInputDialog("Input some chinese character");
try
{
TestByte=name.getBytes("ASCII");
}
catch(UnsupportedEncodingException e)
{
System.out.println(e);
}
try
{
NewName= new String(TestByte,"ASCII");
}
catch(UnsupportedEncodingException e)
{
System.out.println(e);
}
System.out.println(NewName);
System.out.println(TestByte);
String temp="可以可以可以可以";
try
{
OutByte=temp.getBytes("ASCII");
System.out.println("八个汉字的 bit数组的长度是"+OutByte.length);
System.arraycopy(TestByte,0,OutByte,2,2);
OutName=new String(OutByte,"ASCII");
}
catch(UnsupportedEncodingException e)
{
System.out.println(e);
}
System.out.println(OutName);
String a="一";
String b="二二";
String c="三三三";
try
{
outa=a.getBytes("ASCII");
outb=b.getBytes("ASCII");
outc=c.getBytes("ASCII");
}
catch(UnsupportedEncodingException e)
{
System.out.println(e);
}
System.out.println(outa.length);
System.out.println(outb.length);
System.out.println(outc.length);
TempInt=5;
Byte TempByte=TempInt.byteValue();
System.out.println(TempByte);
System.out.println("sdfkljds ");
}
private byte[] TestByte;
private byte[] OutByte;
private byte[] outa;
private byte[] outb;
private byte[] outc;
private String NewName;
private String OutName;
private String name;
private Integer TempInt;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?