Java tutorial
//package com.java2s; public class Main { public static int setAlpha0to1(int color, float alpha) { return color & 0x00FFFFFF | Math.round(0xFF * alpha) << 24; } }