相关代码 |
|
package es.sing.util; public class BitArray{ static int codes[]=new int[31]; static{ codes[0]=1; codes[1]=2; for (int i=2;i codes[i]=codes[i-1]*2; } } public static boolean isActive(int bitArray, int index){ return (bitArray & codes[index])!=0; } public static void main(String args[]){ int bitA=Integer.parseInt("010010",2); for(int i=0;i System.out.println(isActive(bitA,i)); } } };
相关资源 |
|