Since this is a JSON representation of an array, you can use any JSON api.
For instance using Jackson:
String s = "[1,2,3]";
long[] a = new ObjectMapper().reader(long[].class).readValue(s);
List<Long> l = new ObjectMapper().reader(List.class).readValue(s);
More Related Contents:
- Write String with preceding zeros into CSV file in java
- How do I create a Java string from the contents of a file?
- How to nicely format floating numbers to string without unnecessary decimal 0’s
- Why can’t strings be mutable in Java and .NET?
- Remove all occurrences of char from string
- String concatenation in Java – when to use +, StringBuilder and concat [duplicate]
- In Java, is there a way to write a string literal without having to escape quotes?
- How to convert a char array back to a string?
- How to remove line breaks from a file in Java?
- How can I get the size of an array, a Collection, or a String in Java?
- Redirect console output to string in Java
- Getting strange output when printing result of a string comparison
- How to remove duplicate white spaces in string using Java?
- Isn’t the size of character in Java 2 bytes?
- java.lang.IllegalStateException: Scanner closed
- How to compare character ignoring case in primitive types
- String replacement in java, similar to a velocity template
- Read String line by line
- How to check a string against null in java?
- Converting a sentence string to a string array of words in Java
- How to get the last characters in a String in Java, regardless of String size
- How to create variables dynamically in Java? [closed]
- substring index range
- How to replace a substring of a string [duplicate]
- How to replace � in a string
- How do I get the last character of a string?
- What’s the quickest way to compare strings in Java?
- Random element from string array [closed]
- Hints for java.lang.String.replace problem? [duplicate]
- What is difference between mutable and immutable String in java