Here you can find the source of longToByte(long l)
public static Byte longToByte(long l)
//package com.java2s; //License from project: LGPL public class Main { public static Byte longToByte(long l) { if (l >= Byte.MIN_VALUE && l <= Byte.MAX_VALUE) { return (byte) l; }/*from w w w. j a v a 2 s . c om*/ return null; } public static byte longToByte(long l, byte defaultValue) { if (l >= Byte.MIN_VALUE && l <= Byte.MAX_VALUE) { return (byte) l; } return defaultValue; } }