How to check whether file is readable or file has read permission in java?

Below java code shows how to check whether file is readable or file has read permission –

[java]
/****************************************************************************************
* Created on 08-2011 Copyright(c) https://kodehelp.com All Rights Reserved.
****************************************************************************************/
package com.kodehelp.javaio;

import java.io.File;

/**
* Created by https://kodehelp.com
* Date: 8/27/11
*/
public class CanReadFile {
public static void main(String args[]){
File file = new File("/demo.txt");
System.out.println(file.canRead() ? "is readable" : "is not readable");
}
}
[/java]