Java Boolean From toBoolean(byte t_logical)

Here you can find the source of toBoolean(byte t_logical)

Description

Convert LOGICAL (L) byte to boolean value

License

Open Source License

Parameter

Parameter Description
t_logical The byte value as stored in the file

Return

The boolean value

Declaration

public static Object toBoolean(byte t_logical) 

Method Source Code

//package com.java2s;
/*//w w w  . j ava2 s .  co m
    
(C) Copyright 2015-2016 Alberto Fern?ndez <infjaf@gmail.com>
(C) Copyright 2014 Jan Schl??in
(C) Copyright 2003-2004 Anil Kumar K <anil@linuxense.com>
    
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 of the License, or (at your option) any later version.
    
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.
    
You should have received a copy of the GNU Lesser General Public
License along with this library.  If not, see <http://www.gnu.org/licenses/>.
    
*/

public class Main {
    /**
     * Convert LOGICAL (L) byte to boolean value
     * @param t_logical The byte value as stored in the file
     * @return The boolean value
     */
    public static Object toBoolean(byte t_logical) {
        if (t_logical == 'Y' || t_logical == 'y' || t_logical == 'T' || t_logical == 't') {
            return Boolean.TRUE;
        } else if (t_logical == 'N' || t_logical == 'n' || t_logical == 'F' || t_logical == 'f') {
            return Boolean.FALSE;
        }
        return null;
    }
}

Related

  1. toBoolean(Boolean bool)
  2. toBoolean(boolean bool)
  3. toBoolean(Boolean bool, boolean defaultValue)
  4. toBoolean(byte b)
  5. toBoolean(byte data[], int offset, boolean value)
  6. toBoolean(byte[] b)
  7. toBoolean(byte[] byteArray)
  8. toBoolean(byte[] bytes, int offset)
  9. toBoolean(byte[] data, int offset)