Java Tutorial

How To Check If A String Is Numeric In Java

This example show you how to check if a string content is numeric or not. It provide totally six methods to use. package com.dev2qa.calculatorexample; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * Created by zhaosong on 2018/5/23. */ public class CheckStringNumeric { public static void main(String args[]) { CheckStringNumeric checkStringNumeric = new CheckStringNumeric(); checkStringNumeric.isNumeric(“-123.45”); checkStringNumeric.isInteger(“-123”); checkStringNumeric.isIntegerByParse(“-123.456”); checkStringNumeric.isDoubleByParse(“-123.456789”);

How To Check If A String Is Numeric In Java Read More »

How To Use Java Code To Set File Permission

java.io.File provide several methods to get or set file permissions in java code. But the drawback of java.io.File ‘s methods is that it can only separate file permission into two groups which is owner or all users. So java 7 introduce java.nio.file.attribute.PosixFilePermission which provide methods that can let you define file permission more accurately for different

How To Use Java Code To Set File Permission Read More »