UUID in sixteen Bit format - Android java.util

Android examples for java.util:UUID

Description

UUID in sixteen Bit format

Demo Code

import java.util.UUID;

public class Main {

  public static String shortUuidFormat = "0000%04X-0000-1000-8000-00805F9B34FB";

  public static UUID sixteenBitUuid(long shortUuid) {
    assert shortUuid >= 0 && shortUuid <= 0xFFFF;
    return UUID.fromString(String.format(shortUuidFormat, shortUuid & 0xFFFF));
  }//from  www .  j a v a2 s  . c o m

}

Related Tutorials