Here you can find the source of doubleToByte(double d)
public static Byte doubleToByte(double d)
//package com.java2s; //License from project: LGPL public class Main { public static Byte doubleToByte(double d) { if (d >= Byte.MIN_VALUE && d <= Byte.MAX_VALUE) { return (byte) d; }//from w w w.j a va 2s . co m return null; } public static byte doubleToByte(double d, byte defaultValue) { if (d >= Byte.MIN_VALUE && d <= Byte.MAX_VALUE) { return (byte) d; } return defaultValue; } }