Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

public class Main {
    public static float[] LABtoXYZ(Float L, float a, float b) {
        float y = (L + 16f) / 116f;
        float x = a / 500f + y;
        float z = y - b / 200f;

        if (Math.pow(y, 3f) > 0.008856f) {
            y = (float) Math.pow(y, 3f);
        } else {
            y = (y - 16f / 116f) / 7.787f;
        }

        if (Math.pow(x, 3f) > 0.008856f) {
            x = (float) Math.pow(x, 3f);
        } else {
            x = (x - 16f / 116f) / 7.787f;
        }

        if (Math.pow(z, 3f) > 0.008856f) {
            z = (float) Math.pow(z, 3f);
        } else {
            z = (z - 16f / 116f) / 7.787f;
        }

        x = 95.047f * x;
        y = 100.000f * y;
        z = 108.883f * z;

        return new float[] { x, y, z };
    }
}