Java Primitive Type Create toPrimitive(Object value)

Here you can find the source of toPrimitive(Object value)

Description

Unwraps the Byte to retrieve the primitive byte.

License

Apache License

Parameter

Parameter Description
value the Object wrapper, must not be null

Exception

Parameter Description
NullPointerException if the value if null
ClassCastException if the object is not <code>Byte</code>

Return

the primitive value

Declaration

public static byte toPrimitive(Object value) 

Method Source Code

//package com.java2s;
/*/*from w ww. ja v  a  2s  .c o m*/
 *  Copyright 2001-2013 Stephen Colebourne
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

public class Main {
    /**
     * Unwraps the <code>Byte</code> to retrieve the primitive <code>byte</code>.
     * 
     * @param value  the Object wrapper, must not be null
     * @return the primitive value
     * @throws NullPointerException if the value if null
     * @throws ClassCastException if the object is not <code>Byte</code>
     */
    public static byte toPrimitive(Object value) {
        return ((Byte) value).byteValue();
    }
}

Related

  1. toPrimitive(Integer[] irri)
  2. toPrimitive(Long[] array)
  3. toPrimitive(Long[] array)
  4. toPrimitive(Long[] array)
  5. toPrimitive(Object o)
  6. toPrimitiveArray(Boolean[] a)
  7. toPrimitiveArray(Byte[] array)
  8. toPrimitiveArray(Byte[] bytes)
  9. toPrimitiveArray(Integer[] array)