Q: Java check string format and extract key-value I have string format like below:

{creationTime: 1429434844, mounted: 5, devId: 20, freeStart:1,
  freeEnd:25, root:26, maxBlocks:10000}

How can I check a string is in the right format like above and extract all key-value pairs? All the keys should be exactly the same and in order, all values are integers. I am not good at regular expression so can someone help? Thank you.

A: I suggest using a JSON library like Jackson. Check out this tutorial.
First create a model class for your data such as the following:
public class DataModel {
    private long creationTime;
    private int mounted;
    private int devId;
    private int freeStart;
    private int root;
    private int maxBlocks;

    // Getters and setters here
}

Then use an ObjectMapper instance to  read the value of the string and populate the member variables in the class.
ObjectMapper mapper = new ObjectMapper(); // can reuse, share globally
DataModel data = mapper.readValue(dataString, DataModel.class);

