Tests a given byte array to see if it contains
only valid characters within the Base64 alphabet.

@param arrayOctect byte array to test
@return true if all bytes are valid characters in the Base64
alphabet or if the byte array is empty; false, otherwise
498948
public static boolean isArrayByteBase64(byte[] arrayOctect) {

        arrayOctect = discardWhitespace(arrayOctect);

        int length = arrayOctect.length;
        if (length == 0) {
            // shouldn't a 0 length array be valid base64 data?
            // return false;
            return true;
        }
        for (int i = 0; i < length; i++) {
            if (!isBase64(arrayOctect[i])) {
                return false;
            }
        }
        return true;
    }
629630
@Override
	public boolean containsPrefixBlock(int prefixLength) {
		checkSubnet(this, prefixLength);
		int divisionCount = getDivisionCount();
		int prevBitCount = 0;
		for(int i = 0; i < divisionCount; i++) {
			AddressDivision division = getDivision(i);
			int bitCount = division.getBitCount();
			int totalBitCount = bitCount + prevBitCount;
			if(prefixLength < totalBitCount) {
				int divPrefixLen = Math.max(0, prefixLength - prevBitCount);
				if(!division.isPrefixBlock(division.getDivisionValue(), division.getUpperDivisionValue(), divPrefixLen)) {
					return false;
				}
				for(++i; i < divisionCount; i++) {
					division = getDivision(i);
					if(!division.isFullRange()) {
						return false;
					}
				}
				return true;
			}
			prevBitCount = totalBitCount;
		}
		return true;
	}
869545
@Override
  public void validate(byte[] blockBuffer, int rowOffset, int rowHead, int blobTail)
  {
    int offset = rowOffset + offset();
    
    int blobLen = BitsUtil.readInt16(blockBuffer, offset + 2);
    int blobOffset = BitsUtil.readInt16(blockBuffer, offset);
    
    if (blobLen == 0) {
      return;
    }
    
    if (blobOffset < 0 || blobTail < blobOffset) {
      throw new IllegalStateException(L.l("{0}: corrupted blob offset {1} with blobTail={2}",
                                          this, blobOffset, blobTail));
    }
    
    if ((blobLen & LARGE_BLOB_MASK) != 0) {
      blobLen &= ~LARGE_BLOB_MASK;
      
      if (blobLen != 4) {
        throw new IllegalStateException(L.l("{0}: corrupted blob len {1} for large blob.",
                                            this, blobOffset));
      }
    }
    
    
    if (blobLen < 0 || blobTail < blobLen + blobOffset) {
      throw new IllegalStateException(L.l("{0}: corrupted blob len {1} with blobOffset={2} blobTail={3}",
                                          this, blobLen, blobOffset, blobTail));
    }
  }
1039789
private function ValidateData(&$array, $index = '', $xss_clean = false) {
        if (!isset($array[$index])) {
            return false;
        }

        if ($xss_clean === true && !($array[$index] instanceof \stdClass)) {
            $array[$index] = strip_tags($array[$index]);
            $array[$index] = filter_var($array[$index]);
//$security = new BL\Security\Security();
            //return $security->xss_clean($array[$index]);
        }

        return $array[$index];
    }
764384
public static boolean checkJBCrypt(String data, String hash) {
        Objects.requireNonNull(data, Required.DATA.toString());
        Objects.requireNonNull(hash, Required.HASH.toString());
        
        return BCrypt.checkpw(data, hash);
    }
1257158
public static boolean isValidNetmask(byte[] segments)
	{
		boolean mustBeZero = false;
		for (int i = 0; i < segments.length; i++)
		{

			// Valid segments: 0, 128, 192, 224, 240, 248, 252, 254, 255
			switch (segments[i])
			{
				case -1:
					if (mustBeZero)
						return false;
					break;
				case 0:
					if (mustBeZero)
					{
						break;
					}
				case -2:
				case -4:
				case -8:
				case -16:
				case -32:
				case -64:
				case -128:
					if (!mustBeZero)
						mustBeZero = true;
					else
					{
						return false;
					}
					break;
				default:
					return false;
			}
		}

		return true;
	}
113366
public boolean isCharacter() {
		if (permissions != null
				&& (permissions.longValue() & SftpFileAttributes.S_IFCHR) == SftpFileAttributes.S_IFCHR) {
			return true;
		}
		return false;
	}
468266
public static boolean isPotentiallyEncryptedBytes(byte[] bytes) {
        checkNotNull(bytes, "bytes");

        // The number of bytes is a non-zero multiple of the block size.
        try {
            return bytes.length != 0 && bytes.length % Cipher.getInstance(CIPHER).getBlockSize() == 0;
        } catch (Throwable t) {
            // This shouldn't happen since AES is supported by all JVMs.
            throw Throwables.propagate(t);
        }
    }
983724
@Override
    CharsetMatch match(CharsetDetector det) {
        boolean     hasBOM = false;
        int         numValid = 0;
        int         numInvalid = 0;
        byte        input[] = det.fRawInput;
        int         i;
        int         trailBytes = 0;
        int         confidence;

        if (det.fRawLength >= 3 &&
                (input[0] & 0xFF) == 0xef && (input[1] & 0xFF) == 0xbb && (input[2] & 0xFF) == 0xbf) {
            hasBOM = true;
        }

        // Scan for multi-byte sequences
        for (i=0; i<det.fRawLength; i++) {
            int b = input[i];
            if ((b & 0x80) == 0) {
                continue;   // ASCII
            }

            // Hi bit on char found.  Figure out how long the sequence should be
            if ((b & 0x0e0) == 0x0c0) {
                trailBytes = 1;
            } else if ((b & 0x0f0) == 0x0e0) {
                trailBytes = 2;
            } else if ((b & 0x0f8) == 0xf0) {
                trailBytes = 3;
            } else {
                numInvalid++;
                continue;
            }

            // Verify that we've got the right number of trail bytes in the sequence
            for (;;) {
                i++;
                if (i>=det.fRawLength) {
                    break;
                }
                b = input[i];
                if ((b & 0xc0) != 0x080) {
                    numInvalid++;
                    break;
                }
                if (--trailBytes == 0) {
                    numValid++;
                    break;
                }
            }
        }

        // Cook up some sort of confidence score, based on presense of a BOM
        //    and the existence of valid and/or invalid multi-byte sequences.
        confidence = 0;
        if (hasBOM && numInvalid==0) {
            confidence = 100;
        } else if (hasBOM && numValid > numInvalid*10) {
            confidence = 80;
        } else if (numValid > 3 && numInvalid == 0) {
            confidence = 100;
        } else if (numValid > 0 && numInvalid == 0) {
            confidence = 80;
        } else if (numValid == 0 && numInvalid == 0) {
            // Plain ASCII. Confidence must be > 10, it's more likely than UTF-16, which
            //              accepts ASCII with confidence = 10.
            // TODO: add plain ASCII as an explicitly detected type.
            confidence = 15;
        } else if (numValid > numInvalid*10) {
            // Probably corruput utf-8 data.  Valid sequences aren't likely by chance.
            confidence = 25;
        }
        return confidence == 0 ? null : new CharsetMatch(det, this, confidence);
    }
623449
protected boolean containsEOLDelimiters(byte[] data) {
        int numCRLFs = 0;
        for (int i = 0; i < data.length; i++) {
            if ('\r' == data[i] || '\n' == data[i]) {
                numCRLFs++;
                if (4 == numCRLFs) {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "contains 4 consecutive CRs and/or LFs: true");
                    }
                    return true;
                }
                if ((i > 0) && ('\n' == data[i])) {
                    if ('\n' == data[i - 1]) {
                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                            Tr.debug(tc, "contains LF-LF: true");
                        }
                        return true;
                    }
                }
            } else {
                // must be in a row, reset counter
                numCRLFs = 0;
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "containsEOLDelimiters: false count=" + numCRLFs);
        }
        return false;
    }
991212
private boolean isValid(CharSequence text) {
        for (int i = 0; i < text.length(); i++) {
            char c = text.charAt(i);
            // as defined by http://www.w3.org/TR/REC-xml/#charsets.
            boolean valid = c == 0x9 || c == 0xA || c == 0xD
                    || (c >= 0x20 && c <= 0xd7ff)
                    || (c >= 0xe000 && c <= 0xfffd);
            if (!valid) {
                return false;
            }
        }
        return true;
    }
664467
boolean matches(final char[] value, final int from) {

        // Check the bounds
        final int len = myCharacters.length;
        if (len + from > value.length || from < 0) {
            return false;
        }

        // Bounds are ok, check all characters.
        // Allow question marks to match any character
        for (int i = 0; i < len; i++) {
            if (myCharacters[i] != value[i + from] && myCharacters[i] != '?') {
                return false;
            }
        }

        // All characters match
        return true;
    }
198346
public boolean isCharacter() throws SftpStatusException, SshException {
		// This is long hand because gcj chokes when it is not? Investigate why
		if ((getAttributes().getPermissions().longValue() & SftpFileAttributes.S_IFCHR) == SftpFileAttributes.S_IFCHR) {
			return true;
		}
		return false;
	}
423463
@VisibleForTesting
	public static boolean isValid(String nip) {
		String normalizedNip = normalizeNip(nip);
		if (normalizedNip.length() != NIP_LENGTH) {
			return false;
		}
		try {
			int checksum = calculateChecksum(normalizedNip);
			return checksum == normalizedNip.charAt(CHECKSUM_CHAR_INDEX) - '0';
		} catch (NumberFormatException e) {
			LOG.debug(format("Invalid nip %s", nip), e);
			return false;
		}
	}
303515
public static boolean isValid(String name) {
		char[] nameChars = name.toCharArray();
		for (int i = 0; i < nameChars.length; i++) {
			boolean valid = i == 0 ? Character.isJavaIdentifierStart(nameChars[i]) : Character.isJavaIdentifierPart(nameChars[i]);
			if (!valid) {
				return valid;
			}
		}
		return true;
	}
880691
private boolean isTypeValid(char type) {
		return (type == MAPPED_ADDRESS || type == RESPONSE_ADDRESS
				|| type == SOURCE_ADDRESS || type == CHANGED_ADDRESS
				|| type == REFLECTED_FROM || type == XOR_MAPPED_ADDRESS
				|| type == ALTERNATE_SERVER || type == XOR_PEER_ADDRESS
				|| type == XOR_RELAYED_ADDRESS || type == DESTINATION_ADDRESS);
	}
944948
public static boolean isValidJavaIdentifier(String str) {
    if (isNullOrEmpty(str)) {
      return false;
    }
    if (JAVA_KEYWORDS.contains(str)) {
      return false;
    }
    if (!Character.isJavaIdentifierStart(str.charAt(0))) {
      return false;
    }
    for (int i = 1; i < str.length(); i++) {
      if (!Character.isJavaIdentifierPart(str.charAt(i))) {
        return false;
      }
    }
    return true;
  }