Here you can find the source of getRoot(File file)
Parameter | Description |
---|---|
file | a parameter |
public static File getRoot(File file)
//package com.java2s; //License from project: Apache License import java.io.File; public class Main { /**/*from ww w . j a v a2s . c o m*/ * @param file * @return */ public static File getRoot(File file) { File parent = file; while (parent.getParentFile() != null) parent = parent.getParentFile(); return parent; // return file without parent (aka root) } }