package com.minres.scviewer.database; public class BitVector { public static final char VALUE_X = 'X'; public static final char VALUE_Z = 'Z'; public static final char VALUE_1 = '1'; public static final char VALUE_0 = '0'; private final int width; private char[] value; public BitVector(int netWidth) { this.width=netWidth; value = new char[netWidth]; for(int i=0; i=0; i--){ int digit=0; for(int j=3; j>=0; j--){ if(value[4*i+j]==VALUE_X ||value[4*i+j]==VALUE_Z ){ res[i]=VALUE_X; } if(value[4*i+j]==VALUE_1) digit+=1<<(3-j); res[i]=Character.forDigit(digit, 16); //((digit < 10) ? '0' + digit : 'a' + digit -10) } } return new String(res); } }