Java Pixel Convert From toPixel(byte b)

Here you can find the source of toPixel(byte b)

Description

to Pixel

License

Apache License

Declaration

public static float toPixel(byte b) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static float toPixel(byte b) {
        int unsigned = (int) b & 0xff;
        return toPixelFromByte(unsigned);
    }/*from   w  w w  .  j  a  v a  2s  .co m*/

    private static float toPixelFromByte(int byteValue) {
        return normalize(byteValue, 0, 255);
    }

    private static float normalize(float d, float min, float max) {
        return (d - min) / (max - min);
    }
}

Related

  1. toPixel(float meter)
  2. toPixel(String value)
  3. toPixelByte(float floatValue)
  4. toPixelFromByte(int byteValue)