WeixiangYan/CodeTransOcean huggingface dataset:
Task: Sorting Algorithms_Circle Sort





Java: import java.util.Arrays;

public class CircleSort {

    public static void main(String[] args) {
        circleSort(new int[]{2, 14, 4, 6, 8, 1, 3, 5, 7, 11, 0, 13, 12, -1});
    }

    public static void circleSort(int[] arr) {
        if (arr.length > 0)
            do {
                System.out.println(Arrays.toString(arr));
            } while (circleSortR(arr, 0, arr.length - 1, 0) != 0);
    }

    private static int circleSortR(int[] arr, int lo, int hi, int numSwaps) {
        if (lo == hi)
            return numSwaps;

        int high = hi;
        int low = lo;
        int mid = (hi - lo) / 2;

        while (lo < hi) {
            if (arr[lo] > arr[hi]) {
                swap(arr, lo, hi);
                numSwaps++;
            }
            lo++;
            hi--;
        }

        if (lo == hi && arr[lo] > arr[hi + 1]) {
            swap(arr, lo, hi + 1);
            numSwaps++;
        }

        numSwaps = circleSortR(arr, low, low + mid, numSwaps);
        numSwaps = circleSortR(arr, low + mid + 1, high, numSwaps);

        return numSwaps;
    }

    private static void swap(int[] arr, int idx1, int idx2) {
        int tmp = arr[idx1];
        arr[idx1] = arr[idx2];
        arr[idx2] = tmp;
    }
}






Fortran: 
module circlesort






  implicit none
  logical, private :: csr
  public :: circle_sort
 
contains
 
  recursive logical function csr(a, left, right,n) result(swapped)
    implicit none
    integer, intent(in) :: left, right,n
    integer, intent(inout) :: a(n)
    integer :: lo, hi, mid
    integer :: temp
    logical :: lefthalf,righthalf

    swapped = .FALSE.
    if (right <= left) return
    lo = left   
    hi = right  

    do while (lo < hi)

       if (a(hi) < a(lo)) then
          swapped = .TRUE.
          temp = a(lo)
          a(lo) = a(hi)
          a(hi) = temp
       endif
       lo = lo + 1
       hi = hi - 1
    end do

    if (lo == hi)then
       if(a(hi+1) .lt. a(lo))then
           swapped = .TRUE.
           temp = a(hi+1)
           a(hi+1) = a(lo)
           a(lo) = temp
       endif
    endif
    mid = (left + right) / 2 
    lefthalf = csr(a, left, mid,n)
    righthalf = csr(a, mid + 1, right,n)
    swapped = swapped .or. lefthalf .or. righthalf
  end function csr

  subroutine circle_sort(a, n)
    use iso_c_binding, only: c_ptr, c_loc
    implicit none
    integer, intent(in) :: n
    integer, target,intent(inout) :: a(n)

    do while ( csr(a, 1, n,n))



    end do
  end subroutine circle_sort
 
end module circlesort
program sort
  use circlesort
  implicit none
  integer :: a(9)
  data a/6,7,8,9,2,5,3,4,1/
  call circle_sort(a, size(a))
  print *, a
end program sort
Task: I before E except after C





Java: import java.io.BufferedReader;
import java.io.FileReader;

public class IbeforeE 
{
	public static void main(String[] args)
	{
		IbeforeE now=new IbeforeE();
		String wordlist="unixdict.txt";
		if(now.isPlausibleRule(wordlist))
			System.out.println("Rule is plausible.");
		else
			System.out.println("Rule is not plausible.");
	}
	boolean isPlausibleRule(String filename)
	{
		int truecount=0,falsecount=0;
		try
		{
			BufferedReader br=new BufferedReader(new FileReader(filename));
			String word;
			while((word=br.readLine())!=null)
			{
				if(isPlausibleWord(word))
					truecount++;
				else if(isOppPlausibleWord(word))
					falsecount++;
			}
			br.close();
		}
		catch(Exception e)
		{
			System.out.println("Something went horribly wrong: "+e.getMessage());
		}
		
		System.out.println("Plausible count: "+truecount);
		System.out.println("Implausible count: "+falsecount);
		if(truecount>2*falsecount)
			return true;
		return false;
	}
	boolean isPlausibleWord(String word)
	{
		if(!word.contains("c")&&word.contains("ie"))
			return true;
		else if(word.contains("cei"))
			return true;
		return false;
	}
	boolean isOppPlausibleWord(String word)
	{
		if(!word.contains("c")&&word.contains("ei"))
			return true;
		else if(word.contains("cie"))
			return true;
		return false;
	}
}






Fortran: 













program cia
  implicit none
  character (len=256) :: s
  integer :: ie, ei, cie, cei
  integer :: ios
  data ie, ei, cie, cei/4*0/
  do while (.true.)
    read(5,*,iostat = ios)s
    if (0 .ne. ios) then
      exit
    endif
    call lower_case(s)
    cie = cie + occurrences(s, 'cie')
    cei = cei + occurrences(s, 'cei')
    ie = ie + occurrences(s, 'ie')
    ei = ei + occurrences(s, 'ei')
  enddo
  write(6,'(1x,4(a4,1x))') 'ie','ei','cie','cei'
  write(6,'(1x,4(i4,1x))') ie,ei,cie,cei 
  write(6,'(1x,2(a,1x))') '        [^c]ie',plausibility(ie,ei)
  write(6,'(1x,2(a,1x))') '           cei',plausibility(cei,cie)
  write(6,'(1x,2(a,1x))') '([^c]ie)|(cei)',plausibility(ie+cei,ei+cie)

contains

  subroutine lower_case(s)
    character(len=*), intent(inout) :: s
    integer :: i
    do i=1, len_trim(s)
      s(i:i) = achar(ior(iachar(s(i:i)),32))
    enddo
  end subroutine lower_case

  integer function occurrences(a,b)
    character(len=*), intent(in) :: a, b
    integer :: i, j, n
    n = 0
    i = 0
    j = index(a, b)
    do while (0 .lt. j)
      n = n+1
      i = i+len(b)+j-1
      j = index(a(i:), b)
    end do
    occurrences = n
  end function occurrences

  character*(32) function plausibility(da, nyet)
    integer, intent(in) :: da, nyet
    
    if (nyet*2 .lt. da) then
      plausibility = 'plausible'
    else
      plausibility = 'implausible'
    endif
  end function plausibility
end program cia
Task: Generate Chess960 starting position





Java: import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class Chess960{
	private static List<Character> pieces = Arrays.asList('R','B','N','Q','K','N','B','R');

	public static List<Character> generateFirstRank(){
		do{
			Collections.shuffle(pieces);
		}while(!check(pieces.toString().replaceAll("[^\\p{Upper}]", ""))); 
		
		return pieces;
	}

	private static boolean check(String rank){
		if(!rank.matches(".*R.*K.*R.*")) return false;			
		if(!rank.matches(".*B(..|....|......|)B.*")) return false;	
		return true;
	}

	public static void main(String[] args){
		for(int i = 0; i < 10; i++){
			System.out.println(generateFirstRank());
		}
	}
}






Fortran: program chess960
    implicit none
    
    integer, pointer  :: a,b,c,d,e,f,g,h
    integer, target   :: p(8)
    a => p(1)
    b => p(2)
    c => p(3)
    d => p(4)
    e => p(5)
    f => p(6)
    g => p(7)
    h => p(8)

    king: do a=2,7                                        
        r1: do b=1,a-1                                    
            r2: do c=a+1,8                                
                b1: do d=1,7,2                            
                    if (skip_pos(d,4)) cycle
                    b2: do e=2,8,2                        
                        if (skip_pos(e,5)) cycle
                        queen: do f=1,8                   
                            if (skip_pos(f,6)) cycle
                            n1: do g=1,7                  
                                if (skip_pos(g,7)) cycle
                                n2: do h=g+1,8            
                                    if (skip_pos(h,8)) cycle
                                    if (sum(p) /= 36) stop 'Loop error'  
                                    call write_position
                                end do n2
                            end do n1
                        end do queen
                    end do b2
                end do b1
            end do r2
        end do r1
    end do king
    
contains

    logical function skip_pos(i, n)
        integer, intent(in) :: i, n
        skip_pos = any(p(1:n-1) == i)
    end function skip_pos

    subroutine write_position
        integer           :: i, j
        character(len=15) :: position = ' '
        character(len=1), parameter  :: names(8) = ['K','R','R','B','B','Q','N','N']
        do i=1,8
            j = 2*p(i)-1
            position(j:j) = names(i)
        end do
        write(*,'(a)') position
    end subroutine write_position
    
end program chess960
Task: Naming conventions





Java: 

module shop.acme.com
    {
    
    const Point(Int x, Int y);
    enum Color {Red, Green, Blue}
    interface Callback
        {
        
        Boolean active;
        void onEvent(String event);
        void onError(Exception e);
        }

    
    String DefaultLogin = "guest";
    Int    MAX_QUANTITY = 100;

    
    interface Bag<Element>
            extends Iterable<Element>
        {
        void add(Element e);
        }
    }






Fortran: IMPLICIT REAL(A-H,O-Z), INTEGER(I-M)
Task: Mersenne primes





Java: import java.math.BigInteger;

public class MersennePrimes {
    private static final int MAX = 20;

    private static final BigInteger ONE = BigInteger.ONE;
    private static final BigInteger TWO = BigInteger.valueOf(2);

    private static boolean isPrime(int n) {
        if (n < 2) return false;
        if (n % 2 == 0) return n == 2;
        if (n % 3 == 0) return n == 3;
        int d = 5;
        while (d * d <= n) {
            if (n % d == 0) return false;
            d += 2;
            if (n % d == 0) return false;
            d += 4;
        }
        return true;
    }

    public static void main(String[] args) {
        int count = 0;
        int p = 2;
        while (true) {
            BigInteger m = TWO.shiftLeft(p - 1).subtract(ONE);
            if (m.isProbablePrime(10)) {
                System.out.printf("2 ^ %d - 1\n", p);
                if (++count == MAX) break;
            }
            
            do {
                p = (p > 2) ? p + 2 : 3;
            } while (!isPrime(p));
        }
    }
}






Fortran: program mersenne
    use iso_fortran_env, only: output_unit, INT64
    implicit none

    integer, parameter  :: l=INT64
    integer(kind=l)     :: base
    integer             :: pow

    base = 2

    do pow = 1, 32
        if (is_prime(base-1)) then
            write(output_unit,'(A2,x,I0,x,A3)') "2^", pow, "- 1"
        end if
        base = base * 2
    end do
contains
    pure function is_prime(n)
        integer(kind=l), intent(in) :: n
        logical                     :: is_prime
        integer(kind=l)             :: test

        is_prime = .false.
        if (n < 2) return
        if (modulo(n, 2) == 0) then
            is_prime = n==2
            return
        end if
        if (modulo(n, 3) == 0) then
            is_prime = n==3
            return
        end if

        test = 5
        do
            if (test**2 >= n) then
                is_prime = .true.
                return
            end if

            if (modulo(n, test) == 0) return
            test = test + 2
            if (modulo(n, test) == 0) return
            test = test + 4
        end do
    end function is_prime
end program mersenne
Task: Left factorials





Java: import java.math.BigInteger;

public class LeftFac{
	public static BigInteger factorial(BigInteger n){
		BigInteger ans = BigInteger.ONE;
		for(BigInteger x = BigInteger.ONE; x.compareTo(n) <= 0; x = x.add(BigInteger.ONE)){
			ans = ans.multiply(x);
		}
		return ans;
	}
	
	public static BigInteger leftFact(BigInteger n){
		BigInteger ans = BigInteger.ZERO;
		for(BigInteger k = BigInteger.ZERO; k.compareTo(n.subtract(BigInteger.ONE)) <= 0; k = k.add(BigInteger.ONE)){
			ans = ans.add(factorial(k));
		}
		return ans;
	}
	
	public static void main(String[] args){
		for(int i = 0; i <= 10; i++){
			System.out.println("!" + i + " = " + leftFact(BigInteger.valueOf(i)));
		}
		
		for(int i = 20; i <= 110; i += 10){
			System.out.println("!" + i + " = " + leftFact(BigInteger.valueOf(i)));
		}
		
		for(int i = 1000; i <= 10000; i += 1000){
			System.out.println("!" + i + " has " + leftFact(BigInteger.valueOf(i)).toString().length() + " digits");
		}
	}
}






Fortran:       MODULE LAIROTCAF	
       CONTAINS		
        INTEGER*8 FUNCTION FACT(N)	
         INTEGER N	
         INTEGER I	
          FACT = 1	
          DO I = 2,N		
            FACT = FACT*I		
            IF (FACT.LE.0) STOP "Factorial: Overflow
          END DO		
        END FUNCTION FACT	

        INTEGER*8 FUNCTION LFACT(N)	
         INTEGER N	
         INTEGER K	
          LFACT = 0	
          DO K = 0,N - 1	
            LFACT = LFACT + FACT(K)	
            IF (LFACT.LE.0) STOP "Lfact: Overflow
          END DO		
        END FUNCTION LFACT	
      END MODULE LAIROTCAF	

      PROGRAM POKE
      USE LAIROTCAF
      INTEGER I

      WRITE (6,*) "Left factorials, from 0 to 10..."
      DO I = 0,10
        WRITE (6,1) I,LFACT(I)
    1   FORMAT ("
      END DO

      WRITE (6,*) "Left factorials, from 20 to 110 by tens..."
      DO I = 20,110,10
        WRITE (6,1) I,LFACT(I)
      END DO
      END
Task: Increasing gaps between consecutive Niven numbers





Java: public class NivenNumberGaps {

    
    
    public static void main(String[] args) {
        long prevGap = 0;
        long prevN = 1;
        long index = 0;
        System.out.println("Gap      Gap Index   Starting Niven");
        for ( long n = 2 ; n < 20_000_000_000l ; n++ ) {
            if ( isNiven(n) ) {
                index++;
                long curGap = n - prevN;
                if ( curGap > prevGap ) {
                    System.out.printf("%3d  %,13d  %,15d%n", curGap, index, prevN);
                    prevGap = curGap;
                }
                prevN = n;
            }
        }
    }
    
    public static boolean isNiven(long n) {
        long sum = 0;
        long nSave = n;
        while ( n > 0 ) {
            sum += n % 10;
            n /= 10;
        }
        return nSave % sum == 0;
    }

}






Fortran:        program nivengaps      
       implicit none
       integer*8 prev /1/, gap /0/, sum /0/
       integer*8 nividx /0/, niven /1/
       integer gapidx /1/
       
       character*13 idxfmt
       character*14 nivfmt
       write (*,*) 'Gap no  Gap   Niven index    Niven number '
       write (*,*) '------  ---  -------------  --------------'
       
 10    call divsum(niven, sum)
       if (mod(niven, sum) .EQ. 0) then
          if (niven .GT. prev + gap) then
             gap = niven - prev
             call fmtint(nividx,13,idxfmt)
             call fmtint(prev,14,nivfmt)
             write (*,20) gapidx,gap,idxfmt,nivfmt
             gapidx = gapidx + 1
          end if
          prev = niven
          nividx = nividx + 1
       end if          
       niven = niven + 1
       if (gapidx .LE. 32) go to 10
       
       stop
 20    format (i7,'  ',i3,'  ',a13,'  ',a14)       
       end program

C      Sum of divisors of NN, given the sum of divisors of NN-1       
       subroutine divsum(nn,sum)
          implicit none
          integer*8 n,nn,sum
          n = nn          
          sum = sum + 1
 30       if (n.GT.0 .AND. mod(n,10).EQ.0) then
             sum = sum - 9
             n = n / 10
             go to 30
          end if
       end subroutine  
 
       integer*8 function mod(a,b)
          implicit none
          integer*8 a,b
          mod = a - a/b * b
       end function

C      Format a positive integer with ',' as the thousands separator.
       subroutine fmtint(num, len, str)
          implicit none 
          integer*8 n, num
          integer pos, len, th
          character(*) str
          n=num
          pos=len
          th=2
 40       if (pos.GT.0) then
             if (n.EQ.0) then
                str(pos:pos) = ' '
             else
                str(pos:pos) = achar(mod(n,10) + iachar('0'))
                if (th.EQ.0 .AND. n.GE.10 .AND. pos.GT.1) then
                    th = 2
                    pos = pos-1
                    str(pos:pos) = ','
                else
                    th = th-1
                end if
            end if
            pos = pos - 1
            n = n/10
            go to 40
          end if    
       end subroutine
Task: Old Russian measure of length





Java: public class OldRussianMeasures {

    final static String[] keys = {"tochka", "liniya", "centimeter", "diuym",
        "vershok", "piad", "fut", "arshin", "meter", "sazhen", "kilometer",
        "versta", "milia"};

    final static double[] values = {0.000254, 0.00254, 0.01,0.0254,
        0.04445, 0.1778, 0.3048, 0.7112, 1.0, 2.1336, 1000.0,
        1066.8, 7467.6};

    public static void main(String[] a) {
        if (a.length == 2 && a[0].matches("[+-]?\\d*(\\.\\d+)?")) {
            double inputVal = lookup(a[1]);
            if (!Double.isNaN(inputVal)) {
                double magnitude = Double.parseDouble(a[0]);
                double meters = magnitude * inputVal;
                System.out.printf("%s %s to: %n%n", a[0], a[1]);
                for (String k: keys)
                    System.out.printf("%10s: %g%n", k, meters / lookup(k));
                return;
            }
        }
        System.out.println("Please provide a number and unit");

    }

    public static double lookup(String key) {
        for (int i = 0; i < keys.length; i++)
            if (keys[i].equals(key))
                return values[i];
        return Double.NaN;
    }
}






Fortran: PROGRAM RUS
 IMPLICIT NONE
 REAL, PARAMETER:: E_m = 1.
 REAL, PARAMETER:: E_mm = 1.E-3
 REAL, PARAMETER:: E_km = 1.E+3
 REAL, PARAMETER:: E_cm = 1.E-2
 REAL, PARAMETER:: E_arshin = 71.12 * E_cm
 REAL, PARAMETER:: E_fut = 3./7. * E_arshin
 REAL, PARAMETER:: E_piad = 1./4. * E_arshin
 REAL, PARAMETER:: E_vershok = 1./16. * E_arshin
 REAL, PARAMETER:: E_dyuim = 1./28. * E_arshin
 REAL, PARAMETER:: E_liniya = 1./280. * E_arshin
 REAL, PARAMETER:: E_tochka = 1./2800. * E_arshin
 REAL, PARAMETER:: E_ladon = 7.5 * E_cm
 REAL, PARAMETER:: E_lokot = 45 * E_cm
 REAL, PARAMETER:: E_sazhen = 3. * E_arshin
 REAL, PARAMETER:: E_versta = 1500. * E_arshin
 REAL, PARAMETER:: E_milya = 10500. * E_arshin
 INTEGER, PARAMETER:: N = 16
 CHARACTER(LEN=7), DIMENSION(N):: nam = (/&
  &'m      ', 'mm     ', 'km     ', 'cm     ',&
  &'arshin ', 'fut    ', 'piad   ', 'vershok',&
  &'dyuim  ', 'liniya ', 'tochka ', 'ladon  ',&
  &'lokot  ', 'sazhen ', 'versta ', 'milya  ' /)
 REAL, DIMENSION(N):: wert = (/ &
  &1., E_mm, E_km, E_cm,&
  &E_arshin, E_fut, E_piad, E_vershok,&
  &E_dyuim, E_liniya, E_tochka, E_ladon,&
  &E_lokot, E_sazhen, E_versta, E_milya /)
 CHARACTER(LEN=7):: RD_U
 REAL:: RD_V
 INTEGER:: I, J
 DO I=1, N
  WRITE(*, '(A, " ")', ADVANCE='NO')  nam(I)
 END DO
 WRITE (*, *)
 WRITE(*, '(A)', ADVANCE='NO') 'value unit -> '
 READ(*, *) RD_V, RD_U
 RD_U = ADJUSTL(RD_U)
 J = 1
 DO WHILE (NAM(J) .NE. RD_U)
  J = J + 1
  IF (J .GT. N) STOP "Unit not known: "//RD_U
 END DO
 RD_V = RD_V * wert(J)
 DO I=1, N
  J = J + 1
  IF (J .GT. N) J = 1
  WRITE (*, '(F20.3, " ", A)') RD_V / wert(J), nam(J)
 END DO
END PROGRAM RUS
Task: Type detection





Java: public class TypeDetection {
    private static void showType(Object a) {
        if (a instanceof Integer) {
            System.out.printf("'%s' is an integer\n", a);
        } else if (a instanceof Double) {
            System.out.printf("'%s' is a double\n", a);
        } else if (a instanceof Character) {
            System.out.printf("'%s' is a character\n", a);
        } else {
            System.out.printf("'%s' is some other type\n", a);
        }
    }

    public static void main(String[] args) {
        showType(5);
        showType(7.5);
        showType('d');
        showType(true);
    }
}






Fortran: program input_type_detection_demo
  implicit none

  type text_block_t
     character(len = 10000), allocatable :: lines(:)
  end type text_block_t

  type(text_block_t) :: text_block
  integer :: i

  call print_text ('Print me.')

  allocate (text_block%lines(1:10))
  do i = 1, 10
     write (text_block%lines(i), '("i = ", I0)') i
  end do
  call print_text (text_block)

  open (100, file = 'type_detection-fortran.f90', action = 'read')
  call print_text (100)
  close (100)

contains

  subroutine print_text (source)
    class(*), intent(in) :: source

    select type (source)

    type is (character(len = *))
       
       write (*, '(A)') source

    class is (text_block_t)
       
       block
         integer :: i
         do i = lbound (source%lines, 1), ubound (source%lines, 1)
            write (*, '(A)') trim (source%lines(i))
         end do
       end block

    type is (integer)
       
       block
         character(len = 10000) :: line_buffer
         integer :: stat
         read (source, '(A)', iostat = stat) line_buffer
         do while (stat == 0)
            write (*, '(A)') trim (line_buffer)
            read (source, '(A)', iostat = stat) line_buffer
         end do
       end block

    class default
       
       error stop

    end select
  end subroutine print_text

end program input_type_detection_demo
Task: Selective file copy





Java: import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.File;
import java.io.IOException;
import java.util.Scanner;

class CopysJ {

  public static void main(String[] args) {
    String ddname_IN  = "copys.in.txt";
    String ddname_OUT = "copys.out.txt";
    if (args.length >= 1) { ddname_IN  = args[0].length() > 0 ? args[0] : ddname_IN; }
    if (args.length >= 2) { ddname_OUT = args[1].length() > 0 ? args[1] : ddname_OUT; }

    File dd_IN = new File(ddname_IN);
    File dd_OUT = new File(ddname_OUT);

    try (
      Scanner scanner_IN = new Scanner(dd_IN);
      BufferedWriter writer_OUT = new BufferedWriter(new FileWriter(dd_OUT))
      ) {
      String a;
      String b;
      String c;
      String d;
      String c1;
      String x = "XXXXX";
      String data_IN;
      String data_OUT;
      int ib;

      while (scanner_IN.hasNextLine()) {
        data_IN = scanner_IN.nextLine();
        ib = 0;
        a = data_IN.substring(ib, ib += 5);
        b = data_IN.substring(ib, ib += 5);
        c = data_IN.substring(ib, ib += 4);
        c1=Integer.toHexString(new Byte((c.getBytes())[0]).intValue());
        if (c1.length()<2) { c1="0" + c1; }
        data_OUT = a + c1 + x;
        writer_OUT.write(data_OUT);
        writer_OUT.newLine();
        System.out.println(data_IN);
        System.out.println(data_OUT);
        System.out.println();
      }
    }
    catch (IOException ex) {
      ex.printStackTrace();
    }
    return;
  }
}






Fortran:       PROGRAM TEST	
      TYPE PLACE
       INTEGER		N
       CHARACTER*28	PLACENAME
       REAL		ALTITUDE
       COMPLEX		LATLONG
      END TYPE PLACE
      TYPE HOME
       CHARACTER*28	PLACENAME
       COMPLEX		LATLONG
      END TYPE HOME
      TYPE (PLACE) HERE,THERE	
      TYPE (HOME) IS		
      NAMELIST /STUFF/ HERE,THERE,IS	
      INTEGER F	
      F = 10	

Create an example file to show its format.
      OPEN(F,FILE="Test.txt",STATUS="REPLACE",ACTION="WRITE",	
     1 DELIM="QUOTE")	
      HERE = PLACE(1,"Mt. Cook trig.",20.0,(-41.29980555,174.77629))	
      THERE = HERE		
      THERE.N = 2		
      IS.PLACENAME = "Taipou."	
      IS.LATLONG = (0,0)	
      WRITE (F,STUFF)		
      CLOSE (F)			
      HERE = PLACE(0,"",0,(0,0))
      THERE = HERE
      IS = HOME("",(0,0))
Can now read from the file.
      OPEN(F,FILE="Test.txt",STATUS="OLD",ACTION="READ",	
     1 DELIM="QUOTE")	
      READ (F,STUFF)			
      IS.PLACENAME = HERE.PLACENAME	
      IS.LATLONG = HERE.LATLONG		
      WRITE (6,*) IS			
      END
Task: Special variables





Java: import java.util.Arrays;

public class SpecialVariables {

    public static void main(String[] args) {

        
        
        System.out.println(Arrays.toString(args));

        
        
        System.out.println(SpecialVariables.class);


        

        
        System.out.println(System.getenv());

        
        
        System.out.println(System.getProperties());

        
        
        System.out.println(Runtime.getRuntime().availableProcessors());

    }
}






Fortran:            INQUIRE(FILE = FILENAME(1:L),EXIST = EXIST,	
     1      ERR = 666,IOSTAT = IOSTAT) 		
           IF (EXIST) THEN	
           ...etc.