functs.java

来自「MPICH是MPI的重要研究,提供了一系列的接口函数,为并行计算的实现提供了编程」· Java 代码 · 共 42 行

JAVA
42
字号
import java.io.*;import java.awt.*;import java.util.*;import com.sun.java.swing.*;class FUNCTS {  public static int swapInt (DataInputStream in)       throws IOException  {    byte [] b = new byte [4];    byte t;    in.read (b);    t = b [0]; b [0] = b [3]; b [3] = t;    t = b [1]; b [1] = b [2]; b [2] = t;    return (new DataInputStream (new ByteArrayInputStream (b))).readInt ();  }    //This method may be not be producing correct results in some cases  //So the above method is used. However this may be faster if fixed??  public static int swapInt (int i) {    int a = (i & 0xFF000000) >> 24;    int b = (i & 0x00FF0000) >> 8;    int c = (i & 0x0000FF00) << 8;    int d = (i & 0x000000FF) << 24;    return (a | b | c | d);  }    public static double swapDouble (DataInputStream in)       throws IOException  {    byte [] b = new byte [8];    byte t;    in.read (b);    t = b [0]; b [0] = b [7]; b [7] = t;    t = b [1]; b [1] = b [6]; b [6] = t;    t = b [2]; b [2] = b [5]; b [5] = t;    t = b [3]; b [3] = b [4]; b [4] = t;    return (new DataInputStream (new ByteArrayInputStream (b))).readDouble ();  }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?