Java Byte Create toByte(double x, double gamma)

Here you can find the source of toByte(double x, double gamma)

Description

to Byte

License

Open Source License

Declaration

public static int toByte(double x, double gamma) 

Method Source Code

//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;
    }
}

Related

  1. toByte(char c)
  2. toByte(char c)
  3. toByte(char c)
  4. toByte(char c)
  5. toByte(char hex)
  6. toByte(final byte[] buffer, final int offset)
  7. toByte(final int highNibble, final int lowNibble)
  8. toByte(final String bitString)
  9. toByte(final String strHexa)