Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.LinkedList;

public class Main {
    public static LinkedList<byte[]> eatUpJavaHeap(int eatUpSize, int atomSize) {
        LinkedList<byte[]> list = new LinkedList<byte[]>();
        return eatUpJavaHeap(list, eatUpSize, atomSize);
    }

    public static LinkedList<byte[]> eatUpJavaHeap(LinkedList<byte[]> list, int eatUpSize, int atomSize) {
        try {
            while (list.size() * atomSize < eatUpSize) {
                list.add(new byte[atomSize]);
            }
        } catch (Throwable t) {
            t.printStackTrace();
        } finally {
        }
        return list;
    }
}