This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package CopyFileThread; | |
| import java.io.File; | |
| import java.io.FileInputStream; | |
| import java.io.FileOutputStream; | |
| public class CopyFileThread { | |
| public static void copyFile(String src, String dest) throws Exception { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package FileWriteTread; | |
| import java.io.FileNotFoundException; | |
| import java.io.IOException; | |
| import java.io.RandomAccessFile; | |
| import java.util.RandomAccess; | |
| public class FileWrite { | |
| byte [] buf; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package FileWriteTread; | |
| public class Data { | |
| static byte [] data; | |
| int j; | |
| public byte [] getData () { | |
| return data; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.concurrent.locks.Lock; | |
| import java.util.concurrent.locks.ReentrantLock; | |
| /*Решить задачу про банк: | |
| * 1. Чтобы сумма на счету оставалась не менее 100 | |
| * 2. Синхронизация осуществлялась с помощью чего-нибудь | |
| из java.util.concurrent.* Не через Atomic */ | |
| class Account { | |
| private int money; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package MatrixThread; | |
| /*Реализовать многопоточное перемножение квадратных матриц. Сравнить скорость | |
| выполнения алгоритма с однопоточным решением.*/ | |
| public class MatrixThread extends Thread{ | |
| int [][] mA; | |
| int [][] mB; | |
| int [][] mRuz; | |
| int lineNumber; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package ArrayToList; | |
| /*Написать метод для конвертации массива строк/чисел в список.*/ | |
| import java.util.LinkedList; | |
| import java.util.List; | |
| public class MyClass { | |
| public static void main(String [] args){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package ArrayToList; | |
| import java.util.ArrayList; | |
| /*Написать метод, который создаст список, положит в него 10 | |
| элементов, затем удалит первые два и последний, а затем выведет | |
| результат на экран.*/ | |
| import java.util.LinkedList; | |
| import java.util.List; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package AnyTapeArray; | |
| public class AnyTapeArray <E> { | |
| private E [] arr; | |
| public E getArrIndex(int i){ | |
| return arr[i] ; | |
| } | |
| public void setArr( E [] arr){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package SafeCatalog; | |
| import java.io.BufferedReader; | |
| import java.io.FileInputStream; | |
| import java.io.FileReader; | |
| import java.io.IOException; | |
| import java.util.ArrayList; | |
| import java.util.List; | |
| public class ReadFile { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package SafeCatalog; | |
| import java.io.BufferedReader; | |
| import java.io.File; | |
| import java.io.FileOutputStream; | |
| import java.io.FileReader; | |
| import java.io.IOException; | |
| import java.util.ArrayList; | |
| import java.util.Date; |