已解决 代码
package BinaryTest;
public class BinaryTest {
public static void main(String[] args) {
// TODO Auto-generated method stub
int n = 3;
MyBinary mb = new MyBinary(n);
System.out.println("+"+n+"原码:");
mb.YuanMa();
System.out.println("+"+n+"补码");
mb.YuanMa();
System.out.println("-"+n+"原码:");
mb.YuanMa();
System.out.println("-"+n+"补码码");
mb.BuMa();
}
}
package BinaryTest;
public class MyBinary {
int ib;
int[] bin = new int[8]; //存放整数负数 转换的二进制
int[] ym = new int[8]; //存放原码
int[] bm = new int[8]; //存放补码
public MyBinary() {
}
public MyBinary(int ib) {
this.ib