Here you can find the source of toPrimitive(Object value)
Byte
to retrieve the primitive byte
.
Parameter | Description |
---|---|
value | the Object wrapper, must not be null |
Parameter | Description |
---|---|
NullPointerException | if the value if null |
ClassCastException | if the object is not <code>Byte</code> |
public static byte toPrimitive(Object value)
//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(); } }