Here you can find the source of clampByte(float value)
private static byte clampByte(float value)
//package com.java2s; //License from project: Open Source License public class Main { private static byte clampByte(float value) { return (byte) clamp(Byte.MIN_VALUE, Byte.MAX_VALUE, value); }/*from w w w . j a v a2s . co m*/ private static float clamp(float min, float max, float value) { final float clamp; if (value < min) { clamp = min; } else if (value > max) { clamp = max; } else { clamp = value; } return clamp; } }