Advertisement
believe_me

Untitled

Nov 24th, 2021
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.46 KB | None | 0 0
  1. tatic boolean checkExtension(String path) {
  2.         int lastIndex;
  3.         lastIndex = path.length() - 1;
  4.         char[] pathToFile = path.toCharArray();
  5.         if (pathToFile[lastIndex] != 't' || pathToFile[lastIndex - 1] != 'x' ||
  6. pathToFile[lastIndex - 2] != 't' || pathToFile[lastIndex - 3] != '.') {
  7.             System.out.println("Файл имеет неверное расширение. ");
  8.             return false;
  9.         }
  10.         return true;
  11.     }
  12.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement