Java - Write code to generate Random Integer Id

Requirements

Write code to generate Random Integer Id

Demo

//package com.book2s;

import java.util.*;

public class Main {
    public static void main(String[] argv) {
        System.out.println(generateRandomIntegerId());
    }/*from   ww w .  ja  va  2s . c o m*/

    public static String generateRandomIntegerId() {
        Random random = new Random();
        long abs = Math.abs(random.nextLong());

        return String.valueOf(abs);
    }
}

Related Exercise