Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

import java.util.*;

public class Main {
    public static String longListToString(List<Long> list) {
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("[");

        for (int valuesIndex = 0; valuesIndex < list.size(); valuesIndex++) {
            long value = list.get(valuesIndex);
            stringBuilder.append("0x");
            stringBuilder.append(Long.toHexString(value).toUpperCase());

            if (valuesIndex != list.size() - 1) {
                stringBuilder.append(", ");
            }
        }

        stringBuilder.append("]");

        return stringBuilder.toString();
    }
}