Java Code Examples for sun.security.util.BitArray#set()
The following examples show how to use
sun.security.util.BitArray#set() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ZeroMatrixImpl.java From cs-review with MIT License | 6 votes |
@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; } } } }
Example 2
Source File: IPAddressName.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private void parseIPv6(String name) throws IOException { int slashNdx = name.indexOf('/'); if (slashNdx == -1) { address = InetAddress.getByName(name).getAddress(); } else { address = new byte[32]; byte[] base = InetAddress.getByName (name.substring(0, slashNdx)).getAddress(); System.arraycopy(base, 0, address, 0, 16); // append a mask corresponding to the num of prefix bits specified int prefixLen = Integer.parseInt(name.substring(slashNdx+1)); if (prefixLen < 0 || prefixLen > 128) { throw new IOException("IPv6Address prefix length (" + prefixLen + ") in out of valid range [0,128]"); } // create new bit array initialized to zeros BitArray bitArray = new BitArray(MASKSIZE * 8); // set all most significant bits up to prefix length for (int i = 0; i < prefixLen; i++) bitArray.set(i, true); byte[] maskArray = bitArray.toByteArray(); // copy mask bytes into mask portion of address for (int i = 0; i < MASKSIZE; i++) address[MASKSIZE+i] = maskArray[i]; } }
Example 3
Source File: IPAddressName.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private void parseIPv6(String name) throws IOException { int slashNdx = name.indexOf('/'); if (slashNdx == -1) { address = InetAddress.getByName(name).getAddress(); } else { address = new byte[32]; byte[] base = InetAddress.getByName (name.substring(0, slashNdx)).getAddress(); System.arraycopy(base, 0, address, 0, 16); // append a mask corresponding to the num of prefix bits specified int prefixLen = Integer.parseInt(name.substring(slashNdx+1)); if (prefixLen < 0 || prefixLen > 128) { throw new IOException("IPv6Address prefix length (" + prefixLen + ") in out of valid range [0,128]"); } // create new bit array initialized to zeros BitArray bitArray = new BitArray(MASKSIZE * 8); // set all most significant bits up to prefix length for (int i = 0; i < prefixLen; i++) bitArray.set(i, true); byte[] maskArray = bitArray.toByteArray(); // copy mask bytes into mask portion of address for (int i = 0; i < MASKSIZE; i++) address[MASKSIZE+i] = maskArray[i]; } }
Example 4
Source File: IPAddressName.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private void parseIPv6(String name) throws IOException { int slashNdx = name.indexOf('/'); if (slashNdx == -1) { address = InetAddress.getByName(name).getAddress(); } else { address = new byte[32]; byte[] base = InetAddress.getByName (name.substring(0, slashNdx)).getAddress(); System.arraycopy(base, 0, address, 0, 16); // append a mask corresponding to the num of prefix bits specified int prefixLen = Integer.parseInt(name.substring(slashNdx+1)); if (prefixLen > 128) throw new IOException("IPv6Address prefix is longer than 128"); // create new bit array initialized to zeros BitArray bitArray = new BitArray(MASKSIZE * 8); // set all most significant bits up to prefix length for (int i = 0; i < prefixLen; i++) bitArray.set(i, true); byte[] maskArray = bitArray.toByteArray(); // copy mask bytes into mask portion of address for (int i = 0; i < MASKSIZE; i++) address[MASKSIZE+i] = maskArray[i]; } }
Example 5
Source File: IPAddressName.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private void parseIPv6(String name) throws IOException { int slashNdx = name.indexOf('/'); if (slashNdx == -1) { address = InetAddress.getByName(name).getAddress(); } else { address = new byte[32]; byte[] base = InetAddress.getByName (name.substring(0, slashNdx)).getAddress(); System.arraycopy(base, 0, address, 0, 16); // append a mask corresponding to the num of prefix bits specified int prefixLen = Integer.parseInt(name.substring(slashNdx+1)); if (prefixLen < 0 || prefixLen > 128) { throw new IOException("IPv6Address prefix length (" + prefixLen + ") in out of valid range [0,128]"); } // create new bit array initialized to zeros BitArray bitArray = new BitArray(MASKSIZE * 8); // set all most significant bits up to prefix length for (int i = 0; i < prefixLen; i++) bitArray.set(i, true); byte[] maskArray = bitArray.toByteArray(); // copy mask bytes into mask portion of address for (int i = 0; i < MASKSIZE; i++) address[MASKSIZE+i] = maskArray[i]; } }
Example 6
Source File: IPAddressName.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private void parseIPv6(String name) throws IOException { int slashNdx = name.indexOf('/'); if (slashNdx == -1) { address = InetAddress.getByName(name).getAddress(); } else { address = new byte[32]; byte[] base = InetAddress.getByName (name.substring(0, slashNdx)).getAddress(); System.arraycopy(base, 0, address, 0, 16); // append a mask corresponding to the num of prefix bits specified int prefixLen = Integer.parseInt(name.substring(slashNdx+1)); if (prefixLen < 0 || prefixLen > 128) { throw new IOException("IPv6Address prefix length (" + prefixLen + ") in out of valid range [0,128]"); } // create new bit array initialized to zeros BitArray bitArray = new BitArray(MASKSIZE * 8); // set all most significant bits up to prefix length for (int i = 0; i < prefixLen; i++) bitArray.set(i, true); byte[] maskArray = bitArray.toByteArray(); // copy mask bytes into mask portion of address for (int i = 0; i < MASKSIZE; i++) address[MASKSIZE+i] = maskArray[i]; } }
Example 7
Source File: IPAddressName.java From Bytecoder with Apache License 2.0 | 5 votes |
private void parseIPv6(String name) throws IOException { int slashNdx = name.indexOf('/'); if (slashNdx == -1) { address = InetAddress.getByName(name).getAddress(); } else { address = new byte[32]; byte[] base = InetAddress.getByName (name.substring(0, slashNdx)).getAddress(); System.arraycopy(base, 0, address, 0, 16); // append a mask corresponding to the num of prefix bits specified int prefixLen = Integer.parseInt(name.substring(slashNdx+1)); if (prefixLen < 0 || prefixLen > 128) { throw new IOException("IPv6Address prefix length (" + prefixLen + ") in out of valid range [0,128]"); } // create new bit array initialized to zeros BitArray bitArray = new BitArray(MASKSIZE * 8); // set all most significant bits up to prefix length for (int i = 0; i < prefixLen; i++) bitArray.set(i, true); byte[] maskArray = bitArray.toByteArray(); // copy mask bytes into mask portion of address for (int i = 0; i < MASKSIZE; i++) address[MASKSIZE+i] = maskArray[i]; } }
Example 8
Source File: IPAddressName.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private void parseIPv6(String name) throws IOException { int slashNdx = name.indexOf('/'); if (slashNdx == -1) { address = InetAddress.getByName(name).getAddress(); } else { address = new byte[32]; byte[] base = InetAddress.getByName (name.substring(0, slashNdx)).getAddress(); System.arraycopy(base, 0, address, 0, 16); // append a mask corresponding to the num of prefix bits specified int prefixLen = Integer.parseInt(name.substring(slashNdx+1)); if (prefixLen < 0 || prefixLen > 128) { throw new IOException("IPv6Address prefix length (" + prefixLen + ") in out of valid range [0,128]"); } // create new bit array initialized to zeros BitArray bitArray = new BitArray(MASKSIZE * 8); // set all most significant bits up to prefix length for (int i = 0; i < prefixLen; i++) bitArray.set(i, true); byte[] maskArray = bitArray.toByteArray(); // copy mask bytes into mask portion of address for (int i = 0; i < MASKSIZE; i++) address[MASKSIZE+i] = maskArray[i]; } }
Example 9
Source File: IPAddressName.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private void parseIPv6(String name) throws IOException { int slashNdx = name.indexOf('/'); if (slashNdx == -1) { address = InetAddress.getByName(name).getAddress(); } else { address = new byte[32]; byte[] base = InetAddress.getByName (name.substring(0, slashNdx)).getAddress(); System.arraycopy(base, 0, address, 0, 16); // append a mask corresponding to the num of prefix bits specified int prefixLen = Integer.parseInt(name.substring(slashNdx+1)); if (prefixLen < 0 || prefixLen > 128) { throw new IOException("IPv6Address prefix length (" + prefixLen + ") in out of valid range [0,128]"); } // create new bit array initialized to zeros BitArray bitArray = new BitArray(MASKSIZE * 8); // set all most significant bits up to prefix length for (int i = 0; i < prefixLen; i++) bitArray.set(i, true); byte[] maskArray = bitArray.toByteArray(); // copy mask bytes into mask portion of address for (int i = 0; i < MASKSIZE; i++) address[MASKSIZE+i] = maskArray[i]; } }
Example 10
Source File: IPAddressName.java From hottub with GNU General Public License v2.0 | 5 votes |
private void parseIPv6(String name) throws IOException { int slashNdx = name.indexOf('/'); if (slashNdx == -1) { address = InetAddress.getByName(name).getAddress(); } else { address = new byte[32]; byte[] base = InetAddress.getByName (name.substring(0, slashNdx)).getAddress(); System.arraycopy(base, 0, address, 0, 16); // append a mask corresponding to the num of prefix bits specified int prefixLen = Integer.parseInt(name.substring(slashNdx+1)); if (prefixLen < 0 || prefixLen > 128) { throw new IOException("IPv6Address prefix length (" + prefixLen + ") in out of valid range [0,128]"); } // create new bit array initialized to zeros BitArray bitArray = new BitArray(MASKSIZE * 8); // set all most significant bits up to prefix length for (int i = 0; i < prefixLen; i++) bitArray.set(i, true); byte[] maskArray = bitArray.toByteArray(); // copy mask bytes into mask portion of address for (int i = 0; i < MASKSIZE; i++) address[MASKSIZE+i] = maskArray[i]; } }
Example 11
Source File: IPAddressName.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private void parseIPv6(String name) throws IOException { int slashNdx = name.indexOf('/'); if (slashNdx == -1) { address = InetAddress.getByName(name).getAddress(); } else { address = new byte[32]; byte[] base = InetAddress.getByName (name.substring(0, slashNdx)).getAddress(); System.arraycopy(base, 0, address, 0, 16); // append a mask corresponding to the num of prefix bits specified int prefixLen = Integer.parseInt(name.substring(slashNdx+1)); if (prefixLen > 128) throw new IOException("IPv6Address prefix is longer than 128"); // create new bit array initialized to zeros BitArray bitArray = new BitArray(MASKSIZE * 8); // set all most significant bits up to prefix length for (int i = 0; i < prefixLen; i++) bitArray.set(i, true); byte[] maskArray = bitArray.toByteArray(); // copy mask bytes into mask portion of address for (int i = 0; i < MASKSIZE; i++) address[MASKSIZE+i] = maskArray[i]; } }
Example 12
Source File: IPAddressName.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private void parseIPv6(String name) throws IOException { int slashNdx = name.indexOf('/'); if (slashNdx == -1) { address = InetAddress.getByName(name).getAddress(); } else { address = new byte[32]; byte[] base = InetAddress.getByName (name.substring(0, slashNdx)).getAddress(); System.arraycopy(base, 0, address, 0, 16); // append a mask corresponding to the num of prefix bits specified int prefixLen = Integer.parseInt(name.substring(slashNdx+1)); if (prefixLen > 128) throw new IOException("IPv6Address prefix is longer than 128"); // create new bit array initialized to zeros BitArray bitArray = new BitArray(MASKSIZE * 8); // set all most significant bits up to prefix length for (int i = 0; i < prefixLen; i++) bitArray.set(i, true); byte[] maskArray = bitArray.toByteArray(); // copy mask bytes into mask portion of address for (int i = 0; i < MASKSIZE; i++) address[MASKSIZE+i] = maskArray[i]; } }
Example 13
Source File: IPAddressName.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private void parseIPv6(String name) throws IOException { int slashNdx = name.indexOf('/'); if (slashNdx == -1) { address = InetAddress.getByName(name).getAddress(); } else { address = new byte[32]; byte[] base = InetAddress.getByName (name.substring(0, slashNdx)).getAddress(); System.arraycopy(base, 0, address, 0, 16); // append a mask corresponding to the num of prefix bits specified int prefixLen = Integer.parseInt(name.substring(slashNdx+1)); if (prefixLen < 0 || prefixLen > 128) { throw new IOException("IPv6Address prefix length (" + prefixLen + ") in out of valid range [0,128]"); } // create new bit array initialized to zeros BitArray bitArray = new BitArray(MASKSIZE * 8); // set all most significant bits up to prefix length for (int i = 0; i < prefixLen; i++) bitArray.set(i, true); byte[] maskArray = bitArray.toByteArray(); // copy mask bytes into mask portion of address for (int i = 0; i < MASKSIZE; i++) address[MASKSIZE+i] = maskArray[i]; } }
Example 14
Source File: IPAddressName.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private void parseIPv6(String name) throws IOException { int slashNdx = name.indexOf('/'); if (slashNdx == -1) { address = InetAddress.getByName(name).getAddress(); } else { address = new byte[32]; byte[] base = InetAddress.getByName (name.substring(0, slashNdx)).getAddress(); System.arraycopy(base, 0, address, 0, 16); // append a mask corresponding to the num of prefix bits specified int prefixLen = Integer.parseInt(name.substring(slashNdx+1)); if (prefixLen > 128) throw new IOException("IPv6Address prefix is longer than 128"); // create new bit array initialized to zeros BitArray bitArray = new BitArray(MASKSIZE * 8); // set all most significant bits up to prefix length for (int i = 0; i < prefixLen; i++) bitArray.set(i, true); byte[] maskArray = bitArray.toByteArray(); // copy mask bytes into mask portion of address for (int i = 0; i < MASKSIZE; i++) address[MASKSIZE+i] = maskArray[i]; } }
Example 15
Source File: IPAddressName.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
private void parseIPv6(String name) throws IOException { int slashNdx = name.indexOf('/'); if (slashNdx == -1) { address = InetAddress.getByName(name).getAddress(); } else { address = new byte[32]; byte[] base = InetAddress.getByName (name.substring(0, slashNdx)).getAddress(); System.arraycopy(base, 0, address, 0, 16); // append a mask corresponding to the num of prefix bits specified int prefixLen = Integer.parseInt(name.substring(slashNdx+1)); if (prefixLen > 128) throw new IOException("IPv6Address prefix is longer than 128"); // create new bit array initialized to zeros BitArray bitArray = new BitArray(MASKSIZE * 8); // set all most significant bits up to prefix length for (int i = 0; i < prefixLen; i++) bitArray.set(i, true); byte[] maskArray = bitArray.toByteArray(); // copy mask bytes into mask portion of address for (int i = 0; i < MASKSIZE; i++) address[MASKSIZE+i] = maskArray[i]; } }
Example 16
Source File: IPAddressName.java From j2objc with Apache License 2.0 | 5 votes |
private void parseIPv6(String name) throws IOException { int slashNdx = name.indexOf('/'); if (slashNdx == -1) { address = InetAddress.getByName(name).getAddress(); } else { address = new byte[32]; byte[] base = InetAddress.getByName (name.substring(0, slashNdx)).getAddress(); System.arraycopy(base, 0, address, 0, 16); // append a mask corresponding to the num of prefix bits specified int prefixLen = Integer.parseInt(name.substring(slashNdx+1)); if (prefixLen > 128) throw new IOException("IPv6Address prefix is longer than 128"); // create new bit array initialized to zeros BitArray bitArray = new BitArray(MASKSIZE * 8); // set all most significant bits up to prefix length for (int i = 0; i < prefixLen; i++) bitArray.set(i, true); byte[] maskArray = bitArray.toByteArray(); // copy mask bytes into mask portion of address for (int i = 0; i < MASKSIZE; i++) address[MASKSIZE+i] = maskArray[i]; } }