本文整理汇总了Java中sun.security.util.BitArray.get方法的典型用法代码示例。如果您正苦于以下问题:Java BitArray.get方法的具体用法?Java BitArray.get怎么用?Java BitArray.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.security.util.BitArray
的用法示例。
在下文中一共展示了BitArray.get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setZero
import sun.security.util.BitArray; //导入方法依赖的package包/类
@Override
public void setZero(int[][] matrix) {
final BitArray rows = new BitArray(matrix.length);
final BitArray cols = new BitArray(matrix[0].length);
for (int i = 0; i < matrix.length; i++) {
for (int j = 0; j < matrix[i].length; j++) {
final int item = matrix[i][j];
rows.set(i, rows.get(i) || item == 0);
cols.set(j, cols.get(j) || item == 0);
}
}
for (int i = 0; i < rows.length(); i++) {
for (int j = 0; j < cols.length(); j++) {
if (rows.get(i) || cols.get(j)) {
matrix[i][j] = 0;
}
}
}
}
示例2: go
import sun.security.util.BitArray; //导入方法依赖的package包/类
void go() throws Exception {
Context c = Context.fromJAAS("client");
c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_SPNEGO_MECH_OID);
byte[] token = c.doAs(new Action() {
@Override
public byte[] run(Context me, byte[] input) throws Exception {
me.x().requestCredDeleg(true);
me.x().requestReplayDet(false);
me.x().requestSequenceDet(false);
return me.x().initSecContext(new byte[0], 0, 0);
}
}, null);
DerValue d = new DerValue(token); // GSSToken
DerInputStream ins = d.data; // OID + mech token
d.data.getDerValue(); // skip OID
d = d.data.getDerValue(); // NegTokenInit
d = d.data.getDerValue(); // The SEQUENCE inside
boolean found = false;
// Go through all fields inside NegTokenInit. The reqFlags field
// is optional. It's even not recommended in RFC 4178.
while (d.data.available() > 0) {
DerValue d2 = d.data.getDerValue();
if (d2.isContextSpecific((byte)1)) {
found = true;
System.out.println("regFlags field located.");
BitArray ba = d2.data.getUnalignedBitString();
if (ba.length() != 7) {
throw new Exception("reqFlags should contain 7 bits");
}
if (!ba.get(0)) {
throw new Exception("delegFlag should be true");
}
if (ba.get(2) || ba.get(3)) {
throw new Exception("replay/sequenceFlag should be false");
}
}
}
if (!found) {
System.out.println("Warning: regFlags field not found, too new?");
}
c.dispose();
}