Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    /**
     * Reversre operation of Arrays.toString(int[])
     * @param str [1, 2, 3, 4, 5]
     * @return
     */
    public static int[] fromString(String str) {
        String[] strings = str.replace("[", "").replace("]", "").split(",");
        int result[] = new int[strings.length];
        for (int i = 0; i < result.length; i++) {
            result[i] = Integer.parseInt(strings[i].trim());
        }
        return result;
    }
}