Here you can find the source of bytesToBoolean(byte[] buffer)
Parameter | Description |
---|---|
buffer | The byte array containing the boolean. |
static public boolean bytesToBoolean(byte[] buffer)
//package com.java2s; /************************************************************************ * Copyright (c) Crater Dog Technologies(TM). All Rights Reserved. * ************************************************************************ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * * * This code is free software; you can redistribute it and/or modify it * * under the terms of The MIT License (MIT), as published by the Open * * Source Initiative. (See http://opensource.org/licenses/MIT) * ************************************************************************/ public class Main { /**//from w ww.j a v a 2 s.c o m * This function converts the bytes in a byte array to its corresponding boolean value. * * @param buffer The byte array containing the boolean. * @return The corresponding boolean value. */ static public boolean bytesToBoolean(byte[] buffer) { return bytesToBoolean(buffer, 0); } /** * This function converts the bytes in a byte array at the specified index to its * corresponding boolean value. * * @param buffer The byte array containing the boolean. * @param index The index for the first byte in the byte array. * @return The corresponding boolean value. */ static public boolean bytesToBoolean(byte[] buffer, int index) { return buffer[index] != 0; } }