Here you can find the source of toByte(double x, double gamma)
public static int toByte(double x, double gamma)
//package com.java2s; //License from project: Open Source License public class Main { public static int toByte(double x, double gamma) { return (int) clamp(255.0 * Math.pow(x, 1 / gamma), 0.0, 255.0); }//from w w w. j ava 2s . com public static double clamp(double x, double low, double high) { return (x < high) ? ((x > low) ? x : low) : high; } }