Java Byte Create toByte(Number num)

Here you can find the source of toByte(Number num)

Description

Convert the given number into a Byte instance.

License

Open Source License

Parameter

Parameter Description
num A Number instance.

Return

A instance equivalent to the given number. null if num is null .

Declaration

public static Byte toByte(Number num) 

Method Source Code

//package com.java2s;
/*//from  w ww .j  a v  a2 s.  co  m
 * Copyright (c) 2015 NEC Corporation
 * All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this
 * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html
 */

public class Main {
    /**
     * Convert the given number into a {@link Byte} instance.
     *
     * @param num  A {@link Number} instance.
     * @return  A {@link Byte} instance equivalent to the given number.
     *          {@code null} if {@code num} is {@code null}.
     */
    public static Byte toByte(Number num) {
        return (num == null) ? null : Byte.valueOf(num.byteValue());
    }
}

Related

  1. toByte(int i)
  2. toByte(int n)
  3. toByte(int rgb)
  4. toByte(long l)
  5. toByte(long l, byte[] b, int off, boolean bigEndian)
  6. toByte(Object o)
  7. toByte(Object ob, Byte defaultByte)
  8. toByte(Object obj)
  9. toByte(Object obj)