日期:2014-05-16 浏览次数:20419 次
function createBinaryString (nMask) {
??// nMask must be between -2147483648 and 2147483647
??for (var nFlag = 0, nShifted = nMask, sMask = ""; nFlag < 32; nFlag++, sMask += String(nShifted >>> 31), nShifted <<= 1);
??return sMask;
}
?
var string1 = createBinaryString(11);
var string2 = createBinaryString(4);
var string3 = createBinaryString(1);
?
alert(string1);
// prints 00000000000000000000000000001011, i.e. 11
var bits=string1.split("");
var b26 = bits[25];