java.util.UUID.getMostSignificantBits() 方法

描述

getMostSignificantBits() 方法用于返回此 UUID 的 128 位值的最高有效 64 位。


声明

以下是 java.util.UUID.getMostSignificantBits() 方法的声明。

public long getMostSignificantBits()

参数

NA


返回值

方法调用返回此 UUID 的 128 位值的最高有效 64 位。


异常

NA


示例

下面的例子展示了 java.util.UUID.getMostSignificantBits() 的用法。

package com.tutorialspoint;

import java.util.*;

public class UUIDDemo {
   public static void main(String[] args) {

      // creating UUID      
      UUID uid = UUID.fromString("38400000-8cf0-11bd-b23e-10b96e4ef00d");     

      // checking most significant bits
      System.out.println("Most significant bits: "+uid.getMostSignificantBits());    
   }    
}

让我们编译并运行上面的程序,这将产生以下结果.

Most significant bits: 4053239666997989821