Java Byte Create toByte(Object obj)

Here you can find the source of toByte(Object obj)

Description

Get the byte value of this object, only if the object is an instance of Number

License

Open Source License

Parameter

Parameter Description
obj the object to be converted

Return

the byte value of the object, or 0 if it is not a number.

Declaration

public static byte toByte(Object obj) 

Method Source Code

//package com.java2s;

public class Main {
    /**/*from  w  ww .  j ava  2s.co m*/
     * Get the byte value of this object, only if the object is an instance of Number
     *
     * @param obj the object to be converted
     * @return the byte value of the object, or 0 if it is not a number.
     */
    public static byte toByte(Object obj) {
        return (obj instanceof Number) ? ((Number) obj).byteValue() : 0;
    }
}

Related

  1. toByte(Number num)
  2. toByte(Object o)
  3. toByte(Object ob, Byte defaultByte)
  4. toByte(Object obj)
  5. toByte(Object obj)
  6. toByte(Object obj)
  7. toByte(Object value)
  8. toByte(Object value)
  9. toByte(Object value)